11. composer create-project laravel/laravel laravel8 8.0
22. composer require laravel/ui
33. php artisan ui vue --auth
44. npm install
55. npm run dev
6
7
8Now our Laravel 8 auth system is ready to use.
9To check authentication is successfully installed or not.
10Please browse the links given below.To login check
11example.com/login
12To registration check
13example.com/register
14
15Disable Registration System
16If you want to disable the new user registration system.
17Then go to the web.php route file and change the auth route.
18
19Auth::routes(['register' => false]);
1Laravel's laravel/ui package provides a quick way to scaffold all of the routes and views you need for authentication using a few simple commands:
2
3composer require laravel/ui
4
5php artisan ui vue --auth
1 /*
2 This have a problem, for example:
3 1. you login in browser/device 1 with "remember me" enabled,
4 2. and login with the same user on another browser/device 2 also with "remember me" enabled.
5
6 if you logout that user in browser/device 2,
7 a user in browser/device 1 'remember me' token will be invalid
8 and automatically logouted by default if token invalid.
9
10 to prevent this, in the logout function use this instead:
11 */
12
13 public function logout(){
14 // Auth::logout();
15 Auth::logoutCurrentDevice(); // use this instead of Auth::logout()
16
17 request()->session()->invalidate();
18
19 request()->session()->regenerateToken();
20
21 return redirect('/login');
22 }