Add Page resource to Filament admin panel: Implemented Page model, resource, and associated pages (create, edit, list). Defined page form schema and table configuration. Added migration for pages table.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?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('pages', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->string('slug')->unique();
|
||||
$table->longText('content')->nullable();
|
||||
$table->text('excerpt')->nullable();
|
||||
$table->string('meta_title')->nullable();
|
||||
$table->text('meta_description')->nullable();
|
||||
$table->enum('status', ['draft', 'published', 'archived'])->default('draft');
|
||||
$table->string('featured_image')->nullable();
|
||||
$table->timestamp('published_at')->nullable();
|
||||
$table->foreignId('author_id')->constrained('users')->onDelete('cascade');
|
||||
$table->foreignId('parent_id')->nullable()->constrained('pages')->onDelete('cascade');
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->string('template')->default('default');
|
||||
$table->boolean('is_homepage')->default(false);
|
||||
$table->boolean('show_in_menu')->default(true);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['status', 'published_at']);
|
||||
$table->index(['parent_id', 'sort_order']);
|
||||
$table->index('slug');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pages');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user