From 1250312caba0bdf187dcbf59e56accce6ac7076b Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 26 May 2018 16:53:21 -0600 Subject: [PATCH] Add SettingsController --- app/Http/Controllers/SettingsController.php | 97 +++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 app/Http/Controllers/SettingsController.php diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php new file mode 100644 index 00000000..005a9823 --- /dev/null +++ b/app/Http/Controllers/SettingsController.php @@ -0,0 +1,97 @@ +middleware('auth'); + } + + public function home() + { + return view('settings.home'); + } + + public function homeUpdate(Request $request) + { + $this->validate($request, [ + 'name' => 'required|string|max:30', + ]); + + $name = $request->input('name'); + $user = Auth::user(); + $profile = $user->profile; + + if($profile->name != $name) { + $user->name = $name; + $user->save(); + + $profile->name = $name; + $profile->save(); + + return redirect('/settings/home')->with('status', 'Profile successfully updated!'); + } + return redirect('/settings/home'); + } + + public function password() + { + return view('settings.password'); + } + + public function email() + { + return view('settings.email'); + } + + public function avatar() + { + return view('settings.avatar'); + } + + public function notifications() + { + return view('settings.notifications'); + } + + public function privacy() + { + return view('settings.privacy'); + } + + public function security() + { + return view('settings.security'); + } + + public function applications() + { + return view('settings.applications'); + } + + public function dataExport() + { + return view('settings.dataexport'); + } + + public function dataImport() + { + return view('settings.import.home'); + } + + public function dataImportInstagram() + { + return view('settings.import.ig'); + } + + public function developers() + { + return view('settings.developers'); + } +}