LoginSignup
0
0

More than 1 year has passed since last update.

Laravel コマンド一覧

Posted at

よく使うコマンド一覧

よく使うコマンドを一覧にまとめています。

項番 項目 コマンド
1 バージョン確認 php artisan --version
2 ヘルプ php artisan help <コマンド>
3 起動 php artisan serve
4 コントローラー作成 php artisan make:controller <コントローラー名>
5 テーブル作成 php artisan make:migration <クラス名>
6 マイグレーション実行 php artisan migrate
7 シーダー作成 php artisan make:seeder <シーダー名>
8 シーダー実行 php artisan db:seed
9 ファクトリー作成 php artisan make:factory <ファクトリー名>
10 モデル作成 php artisan make:model <モデル名>

バージョン確認

php artisan --version

ヘルプ

php artisan help <コマンド>
// 使用例
php artisan help make:model

起動

php artisan serve
// Host、Port指定
php artisan serve -host=127.0.0.1 -port=8080

コントローラー作成

php artisan make:controller <コントローラー名>
// 例
php artisan make:controller TweetController

テーブル作成

php artisan make:migration <クラス名>
// 例
php artisan make:migration create_tweets_table

マイグレーション実行

php artisan migrate

シーダー作成

php artisan make:seeder <シーダー名>
// 例
php artisan make:seeder TweetSeeder

シーダー実行

php artisan db:seed
// 個別のシーダーを呼び出す場合
php artisan db:seed —class=TweetSeeder

ファクトリー作成

php artisan make:factory <ファクトリー名>
// 例
php artisan make:factory TweetFactory

モデル作成

php artisan make:model <モデル名>
// 例
php artisan make:model Tweet

※マイグレーションファイルも同時に作成

php artisan make:model <モデル名> —migration
php artisan make:model <モデル名> —m

※モデルファクトリーも同時に作成

php artisan make:model <モデル名> —factory
php artisan make:model <モデル名> —f

※シーダーも同時に作成

php artisan make:model <モデル名> —seeder
php artisan make:model <モデル名> —s

※コントローラーも同時に作成

php artisan make:model <モデル名> —controller
php artisan make:model <モデル名> —c

※モデル・モデルファクトリー・シーダー・コントローラーも同時に作成

php artisan make:model <モデル名> —mfsc
php artisan make:model <モデル名> —all

※ピボットモデルも同時に作成

php artisan make:model <モデル名> —pivot

最後に

初めてLaravelを使ったときにメモしていたコマンドの一覧でした。
何かのお役に立てれば幸いです。

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