22 lines
716 B
PHP
22 lines
716 B
PHP
<?php
|
|
namespace App\Traits;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
trait PostBlueprintGettable
|
|
{
|
|
public function processSchema(Blueprint $table)
|
|
{
|
|
$table->bigIncrements('id');
|
|
$table->text('title')->comment('標題');
|
|
$table->text('content')->nullable()->comment('內容');
|
|
$table->text('excerpt')->nullable()->comment('摘要');
|
|
$table->unsignedBigInteger('user_id')->comment('作者');
|
|
$table->unsignedBigInteger('feature_image_id')->nullable()->comment('主圖');
|
|
$table->timestamps();
|
|
|
|
$table->foreign('user_id')->references('id')->on('users');
|
|
$table->foreign('feature_image_id')->references('id')->on('media_files');
|
|
}
|
|
}
|