simedkom/database/migrations/2025_02_27_030638_create_news_table.php
myuqinurrohman 298092be84 feat: news
2025-02-27 13:25:13 +07:00

37 lines
967 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('news', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->string('slug')->unique();
$table->text('content');
$table->string('image');
$table->string('link')->nullable();
$table->string('tag')->nullable();
$table->enum('category', ['0', '1'])->default('0');
$table->unsignedBigInteger('author_id');
$table->foreign('author_id')->references('id')->on('users');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('news');
}
};