diff --git a/README.md b/README.md
index d6f0c18a..3d0db8c2 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,25 @@ return [
'model' => \Tapp\FilamentHelp\Models\HelpArticle::class,
+ /*
+ |--------------------------------------------------------------------------
+ | Rich Editor Configuration
+ |--------------------------------------------------------------------------
+ |
+ | Configure how images are stored when uploaded via the Content rich editor.
+ | By default, attachments are stored publicly so article HTML can be
+ | rendered without temporary URL generation.
+ |
+ */
+
+ 'editor' => [
+ 'file_attachments' => [
+ 'disk' => env('FILAMENT_HELP_FILE_ATTACHMENTS_DISK'),
+ 'directory' => env('FILAMENT_HELP_FILE_ATTACHMENTS_DIRECTORY', 'help-articles'),
+ 'visibility' => env('FILAMENT_HELP_FILE_ATTACHMENTS_VISIBILITY', 'public'),
+ ],
+ ],
+
/*
|--------------------------------------------------------------------------
| Frontend Configuration
diff --git a/config/filament-help.php b/config/filament-help.php
index 4f203b2b..c33ae318 100644
--- a/config/filament-help.php
+++ b/config/filament-help.php
@@ -1,5 +1,7 @@
\Tapp\FilamentHelp\Models\HelpArticle::class,
+ 'model' => HelpArticle::class,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Rich Editor Configuration
+ |--------------------------------------------------------------------------
+ |
+ | Configure how images are stored when uploaded via the Content rich editor.
+ | By default, attachments are stored publicly so article HTML can be
+ | rendered without temporary URL generation.
+ |
+ */
+
+ 'editor' => [
+ 'file_attachments' => [
+ 'disk' => env('FILAMENT_HELP_FILE_ATTACHMENTS_DISK'),
+ 'directory' => env('FILAMENT_HELP_FILE_ATTACHMENTS_DIRECTORY', 'help-articles'),
+ 'visibility' => env('FILAMENT_HELP_FILE_ATTACHMENTS_VISIBILITY', 'public'),
+ ],
+ ],
/*
|--------------------------------------------------------------------------
@@ -101,4 +122,3 @@
],
];
-
diff --git a/database/migrations/create_help_articles_table.php.stub b/database/migrations/create_help_articles_table.php.stub
index a6304057..fb339532 100644
--- a/database/migrations/create_help_articles_table.php.stub
+++ b/database/migrations/create_help_articles_table.php.stub
@@ -15,13 +15,34 @@ return new class extends Migration
// Add tenant column if tenancy is enabled in config
if (config('filament-help.tenancy.enabled', false)) {
- $tenantColumn = config('filament-help.tenancy.column') ?? 'team_id';
- $onDelete = config('filament-help.tenancy.foreign_key.on_delete', 'cascade');
- $onUpdate = config('filament-help.tenancy.foreign_key.on_update', 'cascade');
+ $tenantModel = config('filament-help.tenancy.model');
- $table->foreignId($tenantColumn)
+ throw_if(! is_string($tenantModel) || $tenantModel === '', InvalidArgumentException::class, 'Tenant model not configured in filament-help.tenancy.model');
+
+ $tenantColumnConfig = config('filament-help.tenancy.column');
+ $tenantColumn = is_string($tenantColumnConfig) && $tenantColumnConfig !== ''
+ ? $tenantColumnConfig
+ : str($tenantModel)->classBasename()->snake()->append('_id')->toString();
+
+ $onDelete = match (config('filament-help.tenancy.foreign_key.on_delete', 'cascade')) {
+ 'cascade' => 'cascade',
+ 'no action' => 'no action',
+ 'restrict' => 'restrict',
+ 'set null' => 'set null',
+ default => 'cascade',
+ };
+
+ $onUpdate = match (config('filament-help.tenancy.foreign_key.on_update', 'cascade')) {
+ 'cascade' => 'cascade',
+ 'no action' => 'no action',
+ 'restrict' => 'restrict',
+ 'set null' => 'set null',
+ default => 'cascade',
+ };
+
+ $table->foreignIdFor($tenantModel, $tenantColumn)
->nullable()
- ->constrained('teams')
+ ->constrained()
->onDelete($onDelete)
->onUpdate($onUpdate);
}
diff --git a/resources/views/components/help-article-content.blade.php b/resources/views/components/help-article-content.blade.php
new file mode 100644
index 00000000..7e48a503
--- /dev/null
+++ b/resources/views/components/help-article-content.blade.php
@@ -0,0 +1,7 @@
+@props(['content'])
+
+@if (filled($content))
+
class(['fi-prose max-w-none']) }}>
+ {!! str($content)->sanitizeHtml() !!}
+
+@endif
diff --git a/resources/views/filament/resources/help-article-resource/pages/view-help-article.blade.php b/resources/views/filament/resources/help-article-resource/pages/view-help-article.blade.php
index d30cec16..f7d81498 100644
--- a/resources/views/filament/resources/help-article-resource/pages/view-help-article.blade.php
+++ b/resources/views/filament/resources/help-article-resource/pages/view-help-article.blade.php
@@ -8,9 +8,7 @@
@endif
@if($this->record->content)
-
- {!! $this->record->content !!}
-
+
@else