Ignore:
Timestamp:
10/17/21 20:28:35 (3 years ago)
Author:
Berat Kjufliju <kufliju@…>
Branches:
develop, master
Children:
e6c1f87
Parents:
d795fa6
Message:

added arch_id validation

Location:
app/Http/Controllers/Dashboard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • app/Http/Controllers/Dashboard/DocumentsController.php

    rd795fa6 rbd9e8e3  
    1717    public function index(Request $request)
    1818    {
    19         if($request->department) {
    20             $documents = Document::with('department')->where('department', function ($query) {
    21                 $query->where('id', $request->department)->get();
    22             });
    23         }
    24         else{
     19        if ($request->query('id')) {
     20            $documents = Document::where('department_id', $request->query('id'))->get();
     21        } else {
    2522            $documents = Document::all();
    2623        }
     
    6865        $document->arch_id = $request->arch_id;
    6966        $document->description = $request->description;
    70         $document->updated_at = $request->Carbon::now();;
    7167
    7268        $document->save();
     
    9086        $document->description = $request->description;
    9187
    92         if(!Storage::disk('local')->has($document->department()->pluck('location')->join("") . '/' . $request->arch_id)){
     88        if (!Storage::disk('local')->has($document->department()->pluck('location')->join("") . '/' . $request->arch_id)) {
    9389            Storage::disk('local')->makeDirectory($document->department()->pluck('location')->join("") . '/' . $request->arch_id);
    9490        }
     
    106102        }
    107103
    108             Alert::flash("New document created successfully");
     104        Alert::flash("New document created successfully");
    109105
    110106        return redirect()->route("dashboard.documents.index");
  • app/Http/Controllers/Dashboard/SettingsController.php

    rd795fa6 rbd9e8e3  
    1818            "user" => auth()->user(),
    1919            "adminAndEditors" => User::where("role_id", 1)->orWhere("role_id", 2)->get(),
     20            "active_tab" => "account"
    2021        ]);
    2122    }
     
    2324    public function updateUsername(UsernameSettingsRequest $request)
    2425    {
    25 //        if($request->validated()){
    26 //        $user = auth()->user();
    27 //        $user->username = $request->username;
    28 //        $user->save();
    29 //
    30 //        auth()->logout();
    31 //        session()->flush();
    32 //
    33 //        return redirect()->route("auth.loginShow");
    34 //        }
    35 //        else {
    36             return back()->withInput(['tab'=>'security']);
    37        // }
     26        if ($request->validated()) {
     27            $user = auth()->user();
     28            $user->username = $request->username;
     29            $user->save();
     30
     31            auth()->logout();
     32            session()->flush();
     33
     34            return redirect()->route("auth.loginShow");
     35        } else {
     36            return back()->with(['active_tab' => 'security']);
     37        }
     38
     39        dd('no');
    3840    }
    3941
Note: See TracChangeset for help on using the changeset viewer.