feat: add career application support for blog authors and expand blog status workflows

This commit is contained in:
Ümit Tunç
2026-08-07 23:21:17 +03:00
parent 9b91b3c847
commit 32b3f5187d
10 changed files with 75 additions and 23 deletions
@@ -6,6 +6,7 @@ use App\Filament\Admin\Resources\Components\TranslationTabs;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Placeholder;
use Filament\Forms\Components\RichEditor;
use Filament\Schemas\Components\Section;
use Filament\Forms\Components\Select;
@@ -80,11 +81,17 @@ class BlogForm
->helperText(__('blog.featured_image_helper'))
->columnSpanFull(),
Placeholder::make('intern_author_info')
->label('Stajyer Yazarı')
->content(fn ($record) => $record?->careerApplication?->name ?? '-')
->visible(fn ($record) => $record?->career_application_id !== null)
->columnSpanFull(),
Select::make('author_id')
->label(__('blog.author_field'))
->relationship('author', 'name')
->default(auth()->id())
->required()
->nullable()
->placeholder('Boş bırakılırsa stajyer yazarı veya Trunçgil')
->columnSpanFull(),
Select::make('category_id')
@@ -110,7 +117,9 @@ class BlogForm
->label(__('blog.status_field'))
->options([
'draft' => __('blog.status_draft'),
'pending' => __('blog.status_pending'),
'published' => __('blog.status_published'),
'rejected' => __('blog.status_rejected'),
'archived' => __('blog.status_archived'),
])
->default('draft')
@@ -76,7 +76,13 @@ class BlogsTable
TextColumn::make('author.name')
->label(__('blog.table_author'))
->searchable()
->formatStateUsing(fn ($state, $record) => $record->author_name)
->searchable(query: function ($query, string $search) {
$query->where(function ($q) use ($search) {
$q->whereHas('author', fn ($sub) => $sub->where('name', 'like', "%{$search}%"))
->orWhereHas('careerApplication', fn ($sub) => $sub->where('name', 'like', "%{$search}%"));
});
})
->sortable(),
TextColumn::make('category.name')