id(); $table->string('title'); $table->string('sub_title')->nullable()->comment('副标题'); $table->unsignedBigInteger('category_id')->nullable()->comment('文章分类'); $table->text('content')->nullable()->comment('文章内容'); $table->timestamp('published_at')->nullable()->comment('发布时间'); $table->unsignedTinyInteger('is_recommend')->default(0)->comment('推荐开关'); $table->unsignedTinyInteger('is_enable')->default(1)->comment('显示开关'); $table->unsignedInteger('sort')->default(0)->comment('排序'); // 可能用到的额外字段 $table->string('cover')->nullable()->comment('封面'); $table->string('author')->nullable()->comment('作者/来源'); $table->string('category_path')->nullable()->comment('所有分类id'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('articles'); } };