Showing
4 changed files
with
12 additions
and
11 deletions
| ... | @@ -30,16 +30,16 @@ abstract class Controller extends BaseController | ... | @@ -30,16 +30,16 @@ abstract class Controller extends BaseController |
| 30 | public function __construct() | 30 | public function __construct() |
| 31 | { | 31 | { |
| 32 | // Get a user instance for the current user | 32 | // Get a user instance for the current user |
| 33 | - $user = Auth::user(); | 33 | + $user = auth()->user(); |
| 34 | if (!$user) { | 34 | if (!$user) { |
| 35 | $user = User::getDefault(); | 35 | $user = User::getDefault(); |
| 36 | } | 36 | } |
| 37 | // Share variables with views | 37 | // Share variables with views |
| 38 | - view()->share('signedIn', Auth::check()); | 38 | + view()->share('signedIn', auth()->check()); |
| 39 | view()->share('currentUser', $user); | 39 | view()->share('currentUser', $user); |
| 40 | // Share variables with controllers | 40 | // Share variables with controllers |
| 41 | $this->currentUser = $user; | 41 | $this->currentUser = $user; |
| 42 | - $this->signedIn = Auth::check(); | 42 | + $this->signedIn = auth()->check(); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | /** | 45 | /** | ... | ... |
| ... | @@ -64,7 +64,7 @@ class UserController extends Controller | ... | @@ -64,7 +64,7 @@ class UserController extends Controller |
| 64 | ]); | 64 | ]); |
| 65 | 65 | ||
| 66 | $user = $this->user->fill($request->all()); | 66 | $user = $this->user->fill($request->all()); |
| 67 | - $user->password = Hash::make($request->get('password')); | 67 | + $user->password = bcrypt($request->get('password')); |
| 68 | $user->save(); | 68 | $user->save(); |
| 69 | 69 | ||
| 70 | $user->attachRoleId($request->get('role')); | 70 | $user->attachRoleId($request->get('role')); |
| ... | @@ -120,7 +120,7 @@ class UserController extends Controller | ... | @@ -120,7 +120,7 @@ class UserController extends Controller |
| 120 | if ($request->has('password') && $request->get('password') != '') { | 120 | if ($request->has('password') && $request->get('password') != '') { |
| 121 | //dd('cat'); | 121 | //dd('cat'); |
| 122 | $password = $request->get('password'); | 122 | $password = $request->get('password'); |
| 123 | - $user->password = Hash::make($password); | 123 | + $user->password = bcrypt($password); |
| 124 | } | 124 | } |
| 125 | $user->save(); | 125 | $user->save(); |
| 126 | return redirect('/users'); | 126 | return redirect('/users'); | ... | ... |
| ... | @@ -43,6 +43,7 @@ Route::group(['middleware' => 'auth'], function () { | ... | @@ -43,6 +43,7 @@ Route::group(['middleware' => 'auth'], function () { |
| 43 | 43 | ||
| 44 | }); | 44 | }); |
| 45 | 45 | ||
| 46 | + // Uploads | ||
| 46 | Route::post('/upload/image', 'ImageController@upload'); | 47 | Route::post('/upload/image', 'ImageController@upload'); |
| 47 | 48 | ||
| 48 | // Users | 49 | // Users |
| ... | @@ -75,7 +76,6 @@ Route::group(['middleware' => 'auth'], function () { | ... | @@ -75,7 +76,6 @@ Route::group(['middleware' => 'auth'], function () { |
| 75 | Route::get('/settings', 'SettingController@index'); | 76 | Route::get('/settings', 'SettingController@index'); |
| 76 | Route::post('/settings', 'SettingController@update'); | 77 | Route::post('/settings', 'SettingController@update'); |
| 77 | 78 | ||
| 78 | - | ||
| 79 | }); | 79 | }); |
| 80 | 80 | ||
| 81 | // Login using social authentication | 81 | // Login using social authentication | ... | ... |
| ... | @@ -60,8 +60,8 @@ class SocialAuthService | ... | @@ -60,8 +60,8 @@ class SocialAuthService |
| 60 | // Get any attached social accounts or users | 60 | // Get any attached social accounts or users |
| 61 | $socialAccount = $this->socialAccount->where('driver_id', '=', $socialId)->first(); | 61 | $socialAccount = $this->socialAccount->where('driver_id', '=', $socialId)->first(); |
| 62 | $user = $this->userRepo->getByEmail($socialUser->getEmail()); | 62 | $user = $this->userRepo->getByEmail($socialUser->getEmail()); |
| 63 | - $isLoggedIn = \Auth::check(); | 63 | + $isLoggedIn = auth()->check(); |
| 64 | - $currentUser = \Auth::user(); | 64 | + $currentUser = auth()->user(); |
| 65 | 65 | ||
| 66 | // When a user is not logged in but a matching SocialAccount exists, | 66 | // When a user is not logged in but a matching SocialAccount exists, |
| 67 | // Log the user found on the SocialAccount into the application. | 67 | // Log the user found on the SocialAccount into the application. |
| ... | @@ -115,7 +115,7 @@ class SocialAuthService | ... | @@ -115,7 +115,7 @@ class SocialAuthService |
| 115 | 115 | ||
| 116 | private function logUserIn($user) | 116 | private function logUserIn($user) |
| 117 | { | 117 | { |
| 118 | - \Auth::login($user); | 118 | + auth()->login($user); |
| 119 | return redirect('/'); | 119 | return redirect('/'); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| ... | @@ -183,9 +183,10 @@ class SocialAuthService | ... | @@ -183,9 +183,10 @@ class SocialAuthService |
| 183 | */ | 183 | */ |
| 184 | public function detachSocialAccount($socialDriver) | 184 | public function detachSocialAccount($socialDriver) |
| 185 | { | 185 | { |
| 186 | - \Auth::user()->socialAccounts()->where('driver', '=', $socialDriver)->delete(); | 186 | + session(); |
| 187 | + auth()->user()->socialAccounts()->where('driver', '=', $socialDriver)->delete(); | ||
| 187 | \Session::flash('success', $socialDriver . ' account successfully detached'); | 188 | \Session::flash('success', $socialDriver . ' account successfully detached'); |
| 188 | - return redirect(\Auth::user()->getEditUrl()); | 189 | + return redirect(auth()->user()->getEditUrl()); |
| 189 | } | 190 | } |
| 190 | 191 | ||
| 191 | } | 192 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment