Skip to content

Setting the 'default' action on table views. #2059

Answered by danharrin
perrelet asked this question in Help
Discussion options

You must be logged in to vote

Try this, on the List page class:

protected function getTableRecordUrlUsing(): ?Closure
{
    return function (Model $record): ?string {
        $resource = static::getResource();

        if (! $resource::canEdit($record)) {
            return null;
        }

        return $resource::getUrl('edit', ['record' => $record]);
    };
}

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by perrelet
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants