How to remove Auth in Laravel (PHP artisan)

59,030

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

  1. auth/login.blade.php
  2. auth/register.blade.php
  3. auth/passwords/email.blade.php
  4. auth/passwords/reset.blade.php
  5. layouts/app.blade.php
  6. 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'); 
Share:
59,030
Vixed
Author by

Vixed

Updated on July 23, 2022

Comments

  • Vixed
    Vixed almost 2 years

    With this command php artisan make:authI 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