Change action priority in clickable rows

Due to Model policies i have View actions and Edit actions, but when i have View action it changes the priority from edit to view, is there any way of changing that behaviour?
5 Replies
ChesterS
ChesterS2d ago
Are you talking about the resource? AFAIK it just goes to the first action in the list so just change their order I guess or ->recordAction('edit') on the table
Firebat
Firebat2d ago
yes but do to model policies giving a default like that could cause a unauthorized
ChesterS
ChesterS2d ago
->recordAction(fn ($record) => \Auth::user()->can('edit', $record) ? 'edit' : 'view')
Mark
Mark2d ago
I think you need to override getTableRecordUrlUsing().
Firebat
Firebat2d ago
oh, yeah like this maybe you right forgot about ->can() Yeah thats one aproach strange that im passing 'edit' to the recordAction and still goes to view
Want results from more Discord servers?
Add your server