app->singleton(DataStore::class); } /** @return array */ protected function getPackageProviders($app): array { return [ LivewireServiceProvider::class, BladeIconsServiceProvider::class, BladeHeroiconsServiceProvider::class, SupportServiceProvider::class, SchemasServiceProvider::class, FormsServiceProvider::class, ActionsServiceProvider::class, FilamentServiceProvider::class, CommentsServiceProvider::class, ]; } protected function defineDatabaseMigrations(): void { Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('name'); $table->string('email'); $table->string('password'); $table->timestamps(); }); Schema::create('posts', function (Blueprint $table) { $table->id(); $table->string('title'); $table->timestamps(); }); 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']); }); Schema::create('comment_mentions', function (Blueprint $table) { $table->id(); $table->foreignId('comment_id') ->constrained(config('comments.table_names.comments', 'comments')) ->cascadeOnDelete(); $table->morphs('commenter'); $table->timestamps(); $table->unique(['comment_id', 'commenter_id', 'commenter_type']); }); Schema::create('comment_reactions', function (Blueprint $table) { $table->id(); $table->foreignId('comment_id') ->constrained(config('comments.table_names.comments', 'comments')) ->cascadeOnDelete(); $table->morphs('commenter'); $table->string('reaction'); $table->timestamps(); $table->unique(['comment_id', 'commenter_id', 'commenter_type', 'reaction']); }); Schema::create('comment_attachments', function (Blueprint $table) { $table->id(); $table->foreignId('comment_id') ->constrained(config('comments.table_names.comments', 'comments')) ->cascadeOnDelete(); $table->string('file_path'); $table->string('original_name'); $table->string('mime_type'); $table->unsignedBigInteger('size'); $table->string('disk'); $table->timestamps(); }); Schema::create('notifications', function (Blueprint $table) { $table->uuid('id')->primary(); $table->string('type'); $table->morphs('notifiable'); $table->text('data'); $table->timestamp('read_at')->nullable(); $table->timestamps(); }); Schema::create('comment_subscriptions', function (Blueprint $table) { $table->id(); $table->morphs('commentable'); $table->morphs('commenter'); $table->timestamp('created_at')->nullable(); $table->unique(['commentable_type', 'commentable_id', 'commenter_type', 'commenter_id'], 'comment_subscriptions_unique'); }); } protected function getEnvironmentSetUp($app): void { $app['config']->set('app.key', 'base64:'.base64_encode(random_bytes(32))); $app['config']->set('database.default', 'testing'); $app['config']->set('database.connections.testing', [ 'driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '', ]); $app['config']->set('comments.commenter.model', User::class); } }