Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Php artisan make:auth command is not defined

I'm trying to run this command in Laravel 5.2 but it's not working:

php artisan make:auth  

And prompts with these statements:

[InvalidArgumentException]   Command "make:auth" is not defined   Did you mean one of these?           make:test       make:request       make:migration       make:seeder       make:middleware       make:controller       make:provider       make:policy       make:event       make:console       make:job       make:listener       make:model       make:command 
like image 495
naan Avatar asked Dec 31 '15 11:12

naan


People also ask

How do I create an artisan auth in php?

Just run php artisan make:auth and php artisan migrate in a fresh Laravel application. Then, navigate your browser to http://your-app.test/register or any other URL that is assigned to your application. These two commands will take care of scaffolding your entire authentication system!

How do you use AUTH command in Laravel?

Introduction. Want to get started fast? Install the laravel/ui Composer package and run php artisan ui vue --auth in a fresh Laravel application. After migrating your database, navigate your browser to http://your-app.test/register or any other URL that is assigned to your application.

How do you get Auth in Laravel 6?

In Laravel 6.0 make:auth no longer exists. It will generate the auth routes, a HomeController, auth views, and a app. blade. php layout file. The console command will prompt you to confirm overwriting auth files if you've already run the command before.


2 Answers

For Laravel >=6

composer require laravel/ui php artisan ui vue --auth php artisan migrate 

Reference : Laravel Documentation for authentication

it looks you are not using Laravel 5.2, these are the available make commands in L5.2 and you are missing more than just the make:auth command

    make:auth           Scaffold basic login and registration views and routes     make:console        Create a new Artisan command     make:controller     Create a new controller class     make:entity         Create a new entity.     make:event          Create a new event class     make:job            Create a new job class     make:listener       Create a new event listener class     make:middleware     Create a new middleware class     make:migration      Create a new migration file     make:model          Create a new Eloquent model class     make:policy         Create a new policy class     make:presenter      Create a new presenter.     make:provider       Create a new service provider class     make:repository     Create a new repository.     make:request        Create a new form request class     make:seeder         Create a new seeder class     make:test           Create a new test class     make:transformer    Create a new transformer. 

Be sure you have this dependency in your composer.json file

    "laravel/framework": "5.2.*", 

Then run

    composer update 
like image 147
Luis Montoya Avatar answered Sep 20 '22 14:09

Luis Montoya


Update for Laravel 8

laravel/ui still works but is considered legacy. Consider using Laravel Breeze or Laravel Jetstream.

Update for Laravel 6

Now that Laravel 6 is released you need to install laravel/ui.

composer require laravel/ui --dev php artisan ui vue --auth 

You can change vue with react or bootstrap if you use React or Bootstrap in your project (see Using React).

And then you need to perform the migrations and compile the frontend

php artisan migrate npm install && npm run dev 

Source : Laravel Documentation for authentication

Want to get started fast? Install the laravel/ui Composer package and run php artisan ui vue --auth in a fresh Laravel application. After migrating your database, navigate your browser to http://your-app.test/register or any other URL that is assigned to your application. These commands will take care of scaffolding your entire authentication system!

Note: That's only if you want to use scaffolding, you can use the default User model and the Eloquent authentication driver.

like image 32
Nino Avatar answered Sep 18 '22 14:09

Nino