LoginSignup
1
0

More than 1 year has passed since last update.

Laravel 自分がよく使うartisanコマンドまとめ

Posted at

自分がよく使うコマンドをまとめてます。

コントローラー作成

 php artisan make:controller XXXX/Api/XXXXXController

テスト作成

ファイル作成

php artisan make:test XXXX/Api/XXXXController --unit

テスト実行

./vendor/bin/phpunit ./tests/Unit/Http/Controllers/Api/XXXXControllerTest.php

モデル作成

php artisan make:model Models/XXXX

マイグレーションファイル作成

migrationはテーブル名と変更内容がざっくりわかるようにすること!!

ファイル名は、任意だけど作りやすいように分ける。

新規テーブル

php artisan make:migration create_table_テーブル名 --create=テーブル名

項目変更

php artisan make:migration change_column_カラム名 --table=テーブル名

index追加の場合

php artisan_partner make:migration add_index_カラム名 --table=テーブル名

項目追加

php artisan make:migration add_カラム名 --table=テーブル名
1
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
1
0