wip: article AI polish, category SEO fields, cover generator, membership plan seeder
This commit is contained in:
@@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||
namespace App\Filament\Resources\Comments\Pages;
|
||||
|
||||
use App\Filament\Resources\Comments\CommentResource;
|
||||
use App\Filament\Resources\Pages\ListRecords;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListComments extends ListRecords
|
||||
{
|
||||
|
||||
@@ -4,11 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\Comments\Schemas;
|
||||
|
||||
use App\Domain\Blog\ArticleExcerpt;
|
||||
use App\Models\Comment;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class CommentForm
|
||||
@@ -20,7 +21,22 @@ class CommentForm
|
||||
Select::make('article_id')
|
||||
->label(__('admin.fields.article'))
|
||||
->relationship('article', 'title')
|
||||
->required(),
|
||||
->required()
|
||||
->live(),
|
||||
Textarea::make('article_excerpt_preview')
|
||||
->label(__('admin.fields.article_excerpt'))
|
||||
->disabled()
|
||||
->dehydrated(false)
|
||||
->rows(3)
|
||||
->columnSpanFull()
|
||||
->visible(fn (?Comment $record): bool => $record?->article !== null)
|
||||
->afterStateHydrated(function (Textarea $component, mixed $state, ?Comment $record): void {
|
||||
if ($record?->article === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$component->state(app(ArticleExcerpt::class)->forList($record->article, 240));
|
||||
}),
|
||||
TextInput::make('author')
|
||||
->label(__('admin.fields.author'))
|
||||
->required(),
|
||||
|
||||
@@ -4,10 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\Comments\Tables;
|
||||
|
||||
use App\Domain\Blog\ArticleExcerpt;
|
||||
use App\Filament\Support\AdminTable;
|
||||
use App\Models\Comment;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CommentsTable
|
||||
@@ -15,16 +19,32 @@ class CommentsTable
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->modifyQueryUsing(fn ($query) => $query->with('article'))
|
||||
->columns([
|
||||
TextColumn::make('article.title')
|
||||
->label(__('admin.fields.article'))
|
||||
->searchable(),
|
||||
AdminTable::ellipsis(
|
||||
TextColumn::make('article.title')
|
||||
->label(__('admin.fields.article'))
|
||||
->searchable(),
|
||||
),
|
||||
AdminTable::ellipsis(
|
||||
TextColumn::make('article_excerpt')
|
||||
->label(__('admin.fields.article_excerpt'))
|
||||
->getStateUsing(function (Comment $record): string {
|
||||
if ($record->article === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return app(ArticleExcerpt::class)->forList($record->article, 80);
|
||||
}),
|
||||
),
|
||||
TextColumn::make('author')
|
||||
->label(__('admin.fields.author'))
|
||||
->searchable(),
|
||||
TextColumn::make('url')
|
||||
->label(__('admin.fields.url'))
|
||||
->searchable(),
|
||||
AdminTable::ellipsis(
|
||||
TextColumn::make('url')
|
||||
->label(__('admin.fields.url'))
|
||||
->searchable(),
|
||||
),
|
||||
TextColumn::make('ip')
|
||||
->label(__('admin.fields.ip'))
|
||||
->searchable(),
|
||||
@@ -47,7 +67,15 @@ class CommentsTable
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
SelectFilter::make('moderation_status')
|
||||
->label(__('admin.fields.moderation_status'))
|
||||
->options([
|
||||
Comment::STATUS_PENDING => __('admin.options.moderation.pending'),
|
||||
Comment::STATUS_PENDING_AI => __('admin.options.moderation.pending_ai'),
|
||||
Comment::STATUS_APPROVED => __('admin.options.moderation.approved'),
|
||||
Comment::STATUS_REJECTED => __('admin.options.moderation.rejected'),
|
||||
Comment::STATUS_NEEDS_HUMAN => __('admin.options.moderation.needs_human'),
|
||||
]),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
|
||||
Reference in New Issue
Block a user