Search code examples
laravel-nova

Laravel Nova remove resources from navigation


Perhaps someone has already encountered a similar problem and can tell me.

How to delete “resources” item in navigation. Not a separate resource - but in general, completely remove the entire list, including the title.

Screenshot: https://prnt.sc/lw1nup

Need to: https://prnt.sc/lw1xf9

What I was trying to do:

  • I tried to comment out the entire contents of the views / resources / navigation.blade.php file

  • I tried to comment out the new line calling "new ResourceManager" inside registerTools in src / NovaServiceProvider.php.

So far, all without results.


Solution

  • As of v1.2.0 there is a function availableForNavigation in Laravel\Nova\Resource which returns true.

    You can override that function to return false in App\Nova\Resource abstract class.

    /**
     * Determine if this resource is available for navigation.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return bool
     */
    public static function availableForNavigation(Request $request)
    {
        return false;
    }