increments('id'); $table->integer("user_id")->unsigned(); $table->integer("category_id")->unsigned(); $table->integer("confirmed_by")->unsigned()->nullable(); $table->string("title"); $table->string("image_link"); $table->text("content"); $table->string("slug")->unique(); $table->integer("total_likes")->default(0); $table->boolean("is_active")->default(false); $table->boolean("is_confirmed")->default(false); $table->timestamps(); $table->foreign("user_id")->references("id")->on("users")->onDelete("cascade")->onUpdate("cascade"); $table->foreign("confirmed_by")->references("id")->on("users")->onDelete("cascade")->onUpdate("cascade"); $table->foreign("category_id")->references("id")->on("categories")->onDelete("cascade")->onUpdate("cascade"); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('posts'); } }