How to create a dynamic table actions based on record ?
I try to create a dynamic actions in table, but in table actions method i can access the current record
5 Replies
What do you mean clearly
something like this
i want to show an actions based on the record
You've got your answer already. Either add the method on the model or create a separate method/helper/class somewhere that accepts the model as an argument and returns the actions
eg
and then do
this is not a valid code,
actions
doesnt accept the closure, only array.
Also i want to create an actions based on record on table, not userI think you might be thinking about this backwards. ->actions() modifier should be an array of possible actions. Then each action has access to the record so you can show and hide them using ->hidden(fn($record) => $record->shouldShowMethod()) on each action.