laravel-nova-ban icon indicating copy to clipboard operation
laravel-nova-ban copied to clipboard

Hide other action once one is active

Open usman-topdot opened this issue 4 years ago • 1 comments

If a user is banned, the ban action should not show and only unban action should show and vice versa

usman-topdot avatar Dec 30 '19 10:12 usman-topdot

@usman-topdot you can use canSee

            (new Ban)->showOnTableRow()->canSee(function () {
                return ! $this->resource->exists || $this->banned_at === null;
            }),
            (new Unban)->showOnTableRow()->canSee(function () {
                return ! $this->resource->exists || $this->banned_at !== null;
            }),

showOnTableRow is optional if you d'like in dropdown menu have this options.

crossbit avatar Feb 09 '20 00:02 crossbit