serenysoft / nova-permissions

Laravel Nova 4 Roles & Permissions
72 stars 25 forks source link

roles show up in global search #46

Closed nikoo-eshratabadi closed 4 months ago

nikoo-eshratabadi commented 4 months ago

thanks for this great package:D I'm just wondering how i can disable the global search for it since it's not a nova resource i can't just change $globallySearchable variable. any suggestions?

leandrogehlen commented 4 months ago

Hello @nikoo-eshratabadi, thanks for your comment.

to disable $globallySearchable:

Creates Role.php resource in app/Nova/

class Role extends \Sereny\NovaPermissions\Nova\Role
{
    /**
     * Indicates if the resource should be globally searchable.
     *
     * @var bool
     */
    public static $globallySearchable = false;
}

in app/Providers/NovaServiceProvider.php


use App\Nova\Role;

// ...

public function tools()
{
    return [
        // ...
        \Sereny\NovaPermissions\NovaPermissions::make()
            ->roleResource(Role::class)
        ...
}