PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, November 16, 2022

[FIXED] How can I add Laravel Authentication to an initiated Laravel project?

 November 16, 2022     authentication, laravel, laravel-6, laravel-artisan, laravel-ui     No comments   

Issue

is it safe to add Laravel Auth into a project that already started? I'm sure we are not using any Authentication alternative.


Solution

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:

  1. 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
  2. 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.

  3. 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.



Answered By - Ricardo Vargas
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing