Changeset e6c1f87 for app/Http/Controllers/Dashboard/SettingsController.php
- Timestamp:
- 10/18/21 19:54:18 (3 years ago)
- Branches:
- develop, master
- Children:
- b9c4a92
- Parents:
- bd9e8e3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Controllers/Dashboard/SettingsController.php
rbd9e8e3 re6c1f87 3 3 namespace App\Http\Controllers\Dashboard; 4 4 5 use App\Helpers\Alert; 5 6 use App\Http\Requests\Dashboard\EmailSettingsRequest; 6 7 use App\Http\Requests\Dashboard\PasswordSettingsRequest; … … 10 11 use App\Notifications\VerifyNewEmail; 11 12 use Carbon\Carbon; 13 use Illuminate\Contracts\Validation\Validator; 14 use Illuminate\Http\Request; 15 use Illuminate\Validation\ValidationException; 12 16 13 17 class SettingsController extends Controller … … 17 21 return view("dashboard.settings.index")->with([ 18 22 "user" => auth()->user(), 19 "adminAnd Editors" => User::where("role_id", 1)->orWhere("role_id", 2)->get(),23 "adminAndReferents" => User::where("role_id", 1)->orWhere("role_id", 2)->get(), 20 24 "active_tab" => "account" 21 25 ]); … … 24 28 public function updateUsername(UsernameSettingsRequest $request) 25 29 { 26 if ($request->validated()) {27 30 $user = auth()->user(); 28 31 $user->username = $request->username; … … 33 36 34 37 return redirect()->route("auth.loginShow"); 35 } else {36 return back()->with(['active_tab' => 'security']);37 }38 39 dd('no');40 38 } 41 39 42 public function updatePassword( PasswordSettingsRequest $request)40 public function updatePassword(UsernameSettingsRequest $request) 43 41 { 44 $user = auth()->user();45 $user->password = bcrypt($request->password);46 $user->save();42 $user = auth()->user(); 43 $user->password = bcrypt($request->password); 44 $user->save(); 47 45 48 auth()->logout();49 session()->flush();46 auth()->logout(); 47 session()->flush(); 50 48 51 return redirect()->route("auth.loginShow");49 return redirect()->route("auth.loginShow"); 52 50 } 53 51
Note:
See TracChangeset
for help on using the changeset viewer.