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
You can easily remove laravel standard authentication routes by setting false in your auth reference. E.g. Auth::routes(['register' => false]); . This also works for login , verify etc.
It lets you scaffold authentication views, controllers, and routes using Laravel Breeze.
Auth::routes() is just a helper class that helps you generate all the routes required for user authentication. You can browse the code here https://github.com/laravel/framework/blob/5.8/src/Illuminate/Routing/Router.php instead.
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
Check the make:auth command's source to understand the files created by it or the changes.
You will need to delete these files
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');
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');
remove
resources/views/auth
resources/views/home.blade.php
resources/views/layouts
(optional, if you don't want it. It won't affect your code)
then delete
Auth::routes();
Route::get('/home','HomeController@index')->name('home');
then edit the function in HomeController.php to
public function index()
{
return view('welcome');
}
for perfection sake
run php artisan migrate:refresh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With