LoginSignup
0
0

【永久保存版】laravelでファイルを新規作成する時はartisanコマンドを使おう

Last updated at Posted at 2024-06-07

非常に便利だと感じたので記載

コントローラー生成【make:controller】

php artisan make:controller [ファイル名]
おすすめ例)php artisan make:controller TestController --model Test
オプション名 概要
--api コントローラーからcreate,editメソッドを除外する
--model リソースコントローラーを生成する
(※モデルが存在しない場合生成するか選べる)

モデル生成【make:model】

php artisan make:model [ファイル名]
オプション名 概要
-c モデル用のコントローラーを生成

リクエスト生成【make:request】

php artisan make:request [ファイル名]

マイグレーションファイル生成【make:migration】

php artisan make:migration
おすすめ例)php artisan make:migration test --create test
オプション名 概要
--create 指定したテーブル名のマイグレーションファイルが作成される

マイグレーションファイル読み込み【migrate】

php artisan migrate

storageフォルダへのシンボリックリンクを作成する【storage:link】

php artisan storage:link
0
0
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
0
0