我嘗試在 Laravel 5.2 中執行此命令,但它不起作用:
php artisan make:auth
並提示這些語句:
[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:lis tener make:model make:command
P粉7291982072024-01-22 14:01:32
Laravel 8 更新
laravel/ui
仍然有效,但被視為遺留。考慮使用 Laravel Breeze 或 Laravel Jetstream。
Laravel 6 更新
現在 Laravel 6 已發布,您需要安裝 laravel/ui代码>.
composer require laravel/ui --dev php artisan ui vue --auth
如果您在專案中使用React 或Bootstrap,則可以將vue
變更為react
或bootstrap
(請參閱使用React)。
然後您需要執行遷移並編譯前端
php artisan migrate npm install && npm run dev
來源:Laravel 驗證文件
注意:只有當您想要使用鷹架時,才可以使用預設的 User 模型和 Eloquent 驗證驅動程式。
P粉4125335252024-01-22 12:39:20
對於 Laravel >=6
composer require laravel/ui php artisan ui vue --auth php artisan migrate
參考:Laravel 驗證文件
看起來您沒有使用 Laravel 5.2,這些是 L5.2 中可用的 make 命令,您缺少的不僅僅是 make:auth 命令
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.
確保您的composer.json 檔案中有此依賴項
"laravel/framework": "5.2.*",
然後運行
composer update