12
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Laravel6系】php artisan make:authが使えない問題の対処法

Last updated at Posted at 2020-02-27

####はじめに
Laravelの6系から php artisan maek:auth コマンドを使用すると下記画像のメッセージが出てしまいます。
スクリーンショット 2020-02-28 0.20.09.png

こちらの記事を見て環境構築をする度に出くわして、その度々で解決方法を調べていたのでそろそろ言語化して記憶の片隅に残しておきます。

####開発環境

言語・FW     バージョン
Laravel 6.14.0
PHP 7.2.26

####何が変わったのか
Laravel6系から認証機能(Laravel/ui)が別パッケージとして管理されるようになりました。そのためまずはcomposerでパッケージをインストールしましょう。

####composerでlaravel/uiのインストール

~/workspace/sampleProject/src/ $ composer require laravel/ui

Using version ^1.2 for laravel/ui
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing laravel/ui (v1.2.0): Loading from cache
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: laravel/ui
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.

####php artisanコマンドの実行
今回こちらの記事でDocker環境でLaravelの開発構築を行ったので、コンテナ内で php artisanコマンドを実行します。

~/worksoace/sampleProject $ docker-compose exec php bash

// 下記からphpコンテナ内
root:/var/www/# php artisan ui vue --auth

Vue scaffolding installed successfully.
Please run "npm install && npm run dev" to compile your fresh scaffolding.

 The [auth/login.blade.php] view already exists. Do you want to replace it? (yes/no) [no]:
 > yes
 The [auth/passwords/confirm.blade.php] view already exists. Do you want to replace it? (yes/no) [no]:
 > yes
 The [auth/passwords/email.blade.php] view already exists. Do you want to replace it? (yes/no) [no]:
 > yes
 The [auth/passwords/reset.blade.php] view already exists. Do you want to replace it? (yes/no) [no]:
 > yes
 The [auth/register.blade.php] view already exists. Do you want to replace it? (yes/no) [no]:
 > yes
 The [auth/verify.blade.php] view already exists. Do you want to replace it? (yes/no) [no]:
 > yes
 The [home.blade.php] view already exists. Do you want to replace it? (yes/no) [no]:
 > yes
 The [layouts/app.blade.php] view already exists. Do you want to replace it? (yes/no) [no]:
 > yes
Authentication scaffolding generated successfully.

####まとめ
これで下記ルーティングの通りLaravel6系でもLaravelデフォルトの認証機能を使うことができるようになりました。
スクリーンショット 2020-02-28 0.46.22.png

12
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?