cybercog / laravel-nova-ban

Laravel Nova Ban simplify blocking and banning Eloquent models.

Home Page:https://komarev.com/sources/laravel-nova-ban

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hide other action once one is active

usman-topdot opened this issue · comments

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

commented

@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.