Ignore:
Timestamp:
10/21/21 23:45:59 (3 years ago)
Author:
beratkjufliju <kufliju@…>
Branches:
develop, master
Children:
4b7e2d3
Parents:
6b95845
Message:

added fileTypes controller, notifications, excel export, edited views

File:
1 edited

Legend:

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

    r6b95845 rc6b84df  
    55use App\Helpers\Alert;
    66use App\Http\Requests\Dashboard\EmailSettingsRequest;
     7use App\Http\Requests\Dashboard\FileTypeRequest;
    78use App\Http\Requests\Dashboard\PasswordSettingsRequest;
    89use App\Http\Requests\Dashboard\UsernameSettingsRequest;
     10use App\Models\FileType;
    911use App\Models\User;
    1012use App\Http\Controllers\Controller;
     
    1921    public function settings()
    2022    {
     23        $fileType = FileType::find("1");
     24
    2125        return view("dashboard.settings.index")->with([
    2226            "user" => auth()->user(),
    2327            "adminAndReferents" => User::where("role_id", 1)->orWhere("role_id", 2)->get(),
    24             "active_tab" => "account"
     28            "active_tab" => "account",
     29            "fileType" => $fileType
    2530        ]);
    2631    }
     
    3035            $user = auth()->user();
    3136            $user->username = $request->username;
     37            $user->updated_at = Carbon::now();
    3238            $user->save();
    3339
     
    4248            $user = auth()->user();
    4349            $user->password = bcrypt($request->password);
     50            $user->updated_at = Carbon::now();
    4451            $user->save();
    4552
     
    5865        $user->security_code = $user->generateSecurityCode();
    5966        $user->verify_token = $user->generateVerifyToken();
     67        $user->updated_at = Carbon::now();
    6068
    6169        $user->save();
     
    6977    }
    7078
     79
     80
     81    public function fileTypes(FileTypeRequest $request)
     82    {
     83        $fileType = FileType::find("1");
     84
     85        $fileType->mimes = $request->mimes;
     86        $fileType->max_size = $request->max_size;
     87        $fileType->user_id = auth()->id();
     88        $fileType->updated_at = Carbon::now();
     89
     90        if(auth()->user()->hasPermission("manage_file_types")) {
     91            $fileType->save();
     92
     93            Alert::flash("File validations updated successfully");
     94
     95            return redirect()->back();
     96        }
     97        else {
     98            Alert::flash("You don't have permission to change file validations", "error");
     99
     100            return redirect()->back();
     101        }
     102    }
     103
    71104}
Note: See TracChangeset for help on using the changeset viewer.