artisan - dich1/todo GitHub Wiki

cliモードコマンド

php artisan tinker

routing確認コマンド

php artisan route:list

migrateコマンド

概要

ファイルを生成し、カラムはそのファイルに追記して再度migrateコマンドを実行する

  • modelはrailsのようにコマンド実行時にカラム名を指定する訳ではない
  • scaffoldはデフォルトではない
php artisan make:migration create_commit_groups_table --create=commit_groups
    public function up()
    {
        Schema::create('commit_groups', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('commit_id')->unsigned();
            $table->integer('user_id')->unsigned();
            $table->string('content');
            $table->integer('priority')->unsigned();
            $table->timestamps();
        });
    }
php artisan migrate
  • 読み込み直し
php artisan migrate:fresh

makeコマンド

model

php artisan make:model Commit

controller

php artisan make:controller CommitController

request

php artisan make:request CommitRequest

scaffold

https://econosys-system.com/blog/archives/290

php artisan make:scaffold Commit --schema="user_id:integer:unsigned, group_id:integer:unsigned, limit:date, status:boolean:default(false)"
php artisan make:scaffold CommitGroup --schema="commit_id:integer:unsigned, user_id:integer:unsigned, content:string priority:integer:unsigned"