Add Blog module to Citrus Platform: Created Blog resource with CRUD pages, schemas, and models. Implemented localization for English and Turkish, ensuring consistent user experience. Added migrations for blog categories, posts, and comments, including soft delete functionality. Enhanced table and form structures for better organization and usability.
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('blogs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->string('slug')->unique();
|
||||
$table->longText('content');
|
||||
$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('category_id')->nullable()->constrained('blog_categories')->onDelete('set null');
|
||||
$table->json('tags')->nullable();
|
||||
$table->integer('view_count')->default(0);
|
||||
$table->boolean('is_featured')->default(false);
|
||||
$table->boolean('allow_comments')->default(true);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['status', 'published_at']);
|
||||
$table->index(['category_id', 'status']);
|
||||
$table->index(['is_featured', 'status']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('blogs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user