Open Modal with SelectColumn

return $table
            ->columns([
                SelectColumn::make('status')
                    ->options([
                        'pending' => 'Pending',
                        'approved' => 'Approved',
                        'rejected' => 'Rejected',
                    ])
                    ->reactive()
                    ->afterStateUpdated(function ($state, Model $record) {
                        if ($state === 'approved' || $state === 'rejected') {
                            $this->emit('openStatusModal', $record->id, $state);
                        }
                    }),
                ])


StatusModal...
public function openModal($recordId, $status)
    {
        $this->recordId = $recordId;
        $this->status = $status;
        $this->dispatchBrowserEvent('open-modal', ['modalId' => 'statusModal']);
    }
Was this page helpful?