- Rename IsCommenter trait to CanComment, Commenter interface to Commentator - Move models to Models/ namespace (Comment, Reaction, Attachment, Subscription) - Rename user_type/user_id polymorphic columns to commenter_type/commenter_id - Rename Config class to CommentsConfig, update config key tables->table_names - Rename getCommentName() to getCommentDisplayName() on commentator models - Add column_names config section for commenter morph customization - Add table_names config with all 5 tables individually configurable - Expand translation file with structured i18n groups - Update all Blade views, Livewire components, events, listeners, and tests
28 lines
878 B
Plaintext
28 lines
878 B
Plaintext
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create(config('comments.table_names.comments', 'comments'), function (Blueprint $table) {
|
|
$table->id();
|
|
$table->morphs('commentable');
|
|
$table->morphs('commenter');
|
|
$table->foreignId('parent_id')
|
|
->nullable()
|
|
->constrained(config('comments.table_names.comments', 'comments'))
|
|
->cascadeOnDelete();
|
|
$table->text('body');
|
|
$table->timestamp('edited_at')->nullable();
|
|
$table->softDeletes();
|
|
$table->timestamps();
|
|
|
|
$table->index(['commentable_type', 'commentable_id', 'parent_id']);
|
|
});
|
|
}
|
|
};
|