My code My code public static function table(Table $table): Table { $user = auth()->user(); return $table ->columns([ // Tables\Columns\TextColumn::make('content'), Stack::make([ Split::make([ TextColumn::make('userable.name') ->translateLabel() ->weight('bold') ->color(fn (LivewireComponent $livewire, Model $record) => $livewire->ownerRecord->user_id == $record->userable_id ? 'primary' : 'success') ->grow(false), TextColumn::make('created_at') ->translateLabel() ->dateTime() ->color('secondary') ->grow(false), ]), TextColumn::make('content')->html()->wrap(), SpatieMediaLibraryImageColumn::make('attachments')->collection('attachments') ->size(150) ->hidden(fn (LivewireComponent $livewire, Model $record) => $record->getMedia('attachments') ? false : true), ]), ]) ->filters([ // ]) ->headerActions([ // Tables\Actions\CreateAction::make(), Action::make('addComment') ->label(__('Add Comment')) ->form([ RichEditor::make('content') ->translateLabel() ->required(), SpatieMediaLibraryFileUpload::make('attachments')->collection('attachments'), ]) ->action(function (array $data, LivewireComponent $livewire) use ($user): void { $ticket = $livewire->ownerRecord; // abort_unless( // config('filament-ticketing.use_authorization') == false || // $ticket->user_id == $user->id || // $ticket->assigned_to_id == $user->id || // $user->can('manageAllTickets', Ticket::class), // 403 // ); $comment = Mcomment::create([ 'content' => $data['content'], 'userable_id' => $user->id, 'userable_type' => get_class($user), 'commentable_id' => $livewire->ownerRecord->id, 'commentable_type' => get_class($livewire->ownerRecord) ]); // if ($livewire->ownerRecord->user_id == $user->id) { // NewComment::dispatch($comment); // } else { // NewResponse::dispatch($comment); // } }), ]) ->defaultSort('id', 'desc') ->actions([ Tables\Actions\EditAction::make(), Tables\Actions\DeleteAction::make(), ]) ->bulkActions([ // Tables\Actions\DeleteBulkAction::make(), ]); }