LoginSignup
0
0

More than 1 year has passed since last update.

マイグレーションの実行

Posted at

マイグレーションの作成

$php artisan make:migration create_posts_table   

でcreate_posts_tableを作成

public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->id();
            $table->string('name',20);
            $table->integer('member');
            $table->string('title')->nullable();
            $table->text('message')->nullable();
            $table->string('grade')->nullable();
            $table->string('comment')->nullable();
            $table->timestamps();
        });
    }

上記を記載
投稿画面を作りたかったので 'title'と'message'は必須!!
投稿画面に募集人数の項目も作りたかったので

 $table->integer('member');

を追記。これで正しいのかわからないけど....。

あとはマイグレーションを実行するだけ!

$php artisan migrate 

今日はここまで!
明日は投稿機能を作っていく!!

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