is it safe to add Laravel Auth into a project that already started? I'm sure we are not using any Authentication alternative.
-
hmm. so your app doesn't have any authentication at the moment? even the one Laravel itself provides out of the box? – Uzair Riaz May 07 '20 at 14:27
-
I want to use the Laravel's Auth solution itself, but reading the documentation, they recommend to do it in a new project. – Ricardo Vargas May 07 '20 at 14:35
-
I don't think they recommend doing it in a new project. The documentation is just set up to show how to do it in a new project. You can do it in any project assuming you don't already have any conflicting resources. Use source control just to be safe – apokryfos May 07 '20 at 14:36
-
its pretty easy to do, if you havent already. And it integrates pretty well. Read the `AuthenticatesUsers` trait and you should know how to integrate in your project – Uzair Riaz May 07 '20 at 14:38
-
I recommend you use OAuth 2.0. It is often used in laravel. – May 07 '20 at 18:17
1 Answers
Just to provide a small overview of the project, I'm using: - Laravel 6.x - I already Import Laravel UI to use Vue.js in some components
In case you already started your project, you just need to be aware of the following:
Your project doesn't modify any of the following files:
- app/Http/Controllers/HomeController.php
- app/Http/Controllers/Auth/*
- resources/js/app
- resources/views/layouts
You are not using a FrontEnd Library with Laravel UI. This is important because depending on the command you use to start the scaffolding, you can override the app.js file on /resources/js.
You are not overwriting any of the routes of the Auth created by
Auth::routes()
.
To add the Authentication first include laravel/ui with composer:
composer require laravel/ui
Once you've installed laravel/ui you can see the new artisan's commands:
php artisan ui --help
To include the auth scaffolding, I recommend to use the following command:
php artisan ui:auth
I prefer this command because it's safer and it's confirm before overwriting any existing file.

- 721
- 4
- 14