Changeset c6b84df for app/Http/Controllers/Dashboard/SettingsController.php
- Timestamp:
- 10/21/21 23:45:59 (3 years ago)
- Branches:
- develop, master
- Children:
- 4b7e2d3
- Parents:
- 6b95845
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/Dashboard/SettingsController.php
r6b95845 rc6b84df 5 5 use App\Helpers\Alert; 6 6 use App\Http\Requests\Dashboard\EmailSettingsRequest; 7 use App\Http\Requests\Dashboard\FileTypeRequest; 7 8 use App\Http\Requests\Dashboard\PasswordSettingsRequest; 8 9 use App\Http\Requests\Dashboard\UsernameSettingsRequest; 10 use App\Models\FileType; 9 11 use App\Models\User; 10 12 use App\Http\Controllers\Controller; … … 19 21 public function settings() 20 22 { 23 $fileType = FileType::find("1"); 24 21 25 return view("dashboard.settings.index")->with([ 22 26 "user" => auth()->user(), 23 27 "adminAndReferents" => User::where("role_id", 1)->orWhere("role_id", 2)->get(), 24 "active_tab" => "account" 28 "active_tab" => "account", 29 "fileType" => $fileType 25 30 ]); 26 31 } … … 30 35 $user = auth()->user(); 31 36 $user->username = $request->username; 37 $user->updated_at = Carbon::now(); 32 38 $user->save(); 33 39 … … 42 48 $user = auth()->user(); 43 49 $user->password = bcrypt($request->password); 50 $user->updated_at = Carbon::now(); 44 51 $user->save(); 45 52 … … 58 65 $user->security_code = $user->generateSecurityCode(); 59 66 $user->verify_token = $user->generateVerifyToken(); 67 $user->updated_at = Carbon::now(); 60 68 61 69 $user->save(); … … 69 77 } 70 78 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 71 104 }
Note:
See TracChangeset
for help on using the changeset viewer.