lopatin96/laravel-navigation

Laravel navigation

1.0.47 2024-12-08 12:47 UTC

README

View

Header

Replace content of resource/views/layouts/header.blade.php with:

@include('laravel-navigation::navigation.header')

and add imports to resources/js/app.js:

import '../../vendor/lopatin96/laravel-navigation/resources/js/anchor-scroller';

import '../../vendor/lopatin96/laravel-navigation/resources/js/header-links-hider';

Footer

Replace content of resource/views/layouts/footer.blade.php with:

@include('laravel-navigation::navigation.footer')

Navigation-menu

Replace content of resource/views/navigation-menu.blade.php with:

@include('laravel-navigation::navigation.navigation-menu')

Profile

Replace content of resource/views/profile/show.blade.php with:

@include('laravel-navigation::navigation.settings')

and add gates to app/Providers/AppServiceProvider.php:

public function boot(): void
{
    …

    Gate::define('admin_area', static function (User $user) {
        return $user->isAdmin();
    });

    Gate::define('pro_area', static function (User $user) {
        return $user->subscribed();
    });

    Gate::define('true_area', static function (User $user) {
        return true;
    });

    Gate::define('false_area', static function (User $user) {
        return false;
    });
}

Publishing

Localization

php artisan vendor:publish --tag="laravel-navigation-lang"

Views

php artisan vendor:publish --tag="laravel-navigation-views"

Config

php artisan vendor:publish --tag="laravel-navigation-config"