LoginSignup
1
0

More than 1 year has passed since last update.

laravel+コマンド

Posted at
  • プロジェクトの作成
laravel new プロジェクト名
  • モデルの作成
php artisan make:model モデル名
  • コントローラーの作成
php artisan make:controller コントローラー名
  • マイグレーションファイルの作成
php artisan make:migration マイグレーション名
  • マイグレーションの実行
php artisan migrate
  • データベースシーダーの作成
php artisan make:seeder シーダー名
  • データベースシーダーの実行
php artisan db:seed
  • ルートの定義
Route::get('/example', [ExampleController::class, 'methodName']);

上記の例では、/example にアクセスされた時に ExampleController クラスの methodName メソッドを呼び出します。

  • ビューの作成
touch resources/views/ビュー名.blade.php
  • キャッシュの削除
php artisan cache:clear
  • コンフィグのキャッシュの削除
php artisan config:clear
  • ルートキャッシュの削除
php artisan route:clear
  • ビューキャッシュの削除
php artisan view:clear
  • コントローラーの作成(リソースコントローラー)
php artisan make:controller コントローラー名 --resource
  • リソースルートの定義
Route::resource('リソース名', 'コントローラー名');
  • モデルファクトリーの作成
php artisan make:factory ファクトリー名 --model=モデル名
  • モデルファクトリーの実行
factory(モデル名::class)->create();
  • サーバーの起動
php artisan serve
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