0
0

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.

【Laravel】php artisanコマンドメモ(composerも少しだけあり)

Posted at

自分用のメモとして残します。
3,4年前にメモしたものをqiitaに残すだけなので、未整理です。
もしかしたら、最新のLaravelバージョンでは使えないものもあるかも。

よく使うやつは整理するかもです。

【基本】

▼Eloquentモデル作成(単数形が公式推奨)

php artisan make:model テーブル名

▼シーダー作成(ダミーデータ作成)

php artisan make:seeder テーブル名(アッパーキャメル)TableSeeder

▼シーダー実行(database\seeds\DatabaseSeeder.phpに登録されているものが対象)

php artisan db:seed

▼シーダー実行(単体)

php artisan db:seed --class=シーダークラス名

▼ルーティング確認

php artisan route:list

▼マイグレーション作成

php artisan make:マイグレーション名
例:php artisan make:migration create_users_table

▼コントローラ作成(リソース(おまかせ)を使用する場合は-rを使う)

php artisan make:controller Admin/AdminUsersController
php artisan make:controller Admin/AdminUsersController -r
php artisan make:controller Admin/AdminUsersController --resource --model=Photo

▼ページネーション作成

php artisan vendor:publish --tag=laravel-pagination

▼バッチの作成

php artisan make:command バッチ名(アッパーキャメル)Command

【その他】

▼キャッシュ削除

php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear

▼DB初期化(マイグレート実行&初期データ実行)

php artisan migrate:refresh --seed

▼IDEヘルパー更新

php artisan ide-helper:generate

▼最適化まとめ

composer dump-autoload
php artisan clear-compiled
php artisan optimize
php artisan config:cache
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?