How to remove Auth in Laravel (PHP artisan)
Solution 1
Look at the make:auth
command source code to understand what exactly files this command added or changed and revert the changes back.
As you can see, you should remove some views and couple of the controllers.
auth/login.blade.php
auth/register.blade.php
auth/passwords/email.blade.php
auth/passwords/reset.blade.php
layouts/app.blade.php
home.blade.php
Solution 2
Check the make:auth command's source to understand the files created by it or the changes.
You will need to delete these files
- auth/login.blade.php
- auth/register.blade.php
- auth/passwords/email.blade.php
- auth/passwords/reset.blade.php
- layouts/app.blade.php
- home.blade.php
Once that is done
Go to routes/web.php, delete the routes created by the command make:auth. Remove these two lines and your project will run properly.
Auth::routes();
Route::get('/home', 'HomeController@index');
Solution 3
You need to remove user table from database. Also remove migrations entry from migrate tables.
and than comment route code of auth from web.php
file in route folder. like
Auth::routes();
also comment middleware
from HomeController __construct()
function.
$this->middleware('auth');
Vixed
Updated on July 23, 2022Comments
-
Vixed almost 2 years
With this command
php artisan make:auth
I got all the auth stuffs, but I would like to know how to remove it, or just how to reinitialize.I've deleted all files, that was created, but when I re-run the command, this doesn't create the mysql user table again