- Created NewsResource for managing news entries. - Added pages for creating, editing, and listing news. - Defined NewsForm schema for news entry forms. - Configured NewsTable for displaying news records with actions. - Implemented News model with relationships and soft deletes. - Added factories for generating test data for news and tags. - Created migrations for news and tags tables.
37 lines
974 B
PHP
37 lines
974 B
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
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->foreignIdFor(User::class, 'author_id');
|
|
$table->string('title', 200);
|
|
$table->string('slug', 200);
|
|
$table->text('content');
|
|
$table->string('link', 50)->nullable();
|
|
$table->unsignedInteger('view')->default(0);
|
|
$table->timestamp('created_at')->useCurrent();
|
|
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('news');
|
|
}
|
|
};
|