simedkom/database/migrations/2025_02_27_030638_create_news_table.php
myuqinurrohman 3c1212d2e9 chore: display news data
feat: filter news data
2025-03-25 10:34:23 +07:00

39 lines
1.0 KiB
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')->nullable();
$table->string('link')->nullable();
$table->string('tag')->nullable();
$table->enum('category', ['0', '1'])->default('0');
$table->integer('views')->default(0);
$table->unsignedBigInteger('author_id');
$table->foreign('author_id')->references('id')->on('users');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('news');
}
};