PHP code example of nedwors / navigator

1. Go to this page and download the library: Download nedwors/navigator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nedwors / navigator example snippets


// In a Service Provider

Nav::define(fn ($user) => [
    Nav::item('Dashboard')
        ->for('dashboard')
        ->icon('dashboard.svg')
        ->

Nav::define(fn () => [
    Nav::item('Dashboard')
        ->for('dashboard')
        ->icon('dashboard')
]);

Nav::item('Dashboard')

$item->name // Dashboard

Nav::item('Dashboard')->for('/dashboard')

$item->url // /dashboard

Nav::item('Dashboard')->for('dashboard.show', $customer)

Nav::item('Dashboard')->icon('dashboard.svg')

$item->icon

Nav::item('Dashboard')->heroicon('o-cog')

$item->heroicon

Nav::item('Billing')->ion')->

Nav::item('Billing')
    ->therCheck)
    ->

Nav::item('Billing')->subItems([
    Nav::item('Invoices'),
    ...
])

Nav::item('Billing')->subItems([
    // Sub Items here...
])

Nav::define(fn () => [
    // Items go here...
]);

Nav::define(fn (?Authenticable $user, Application $app) => [
    // Items go here...
]);

Nav::define(fn () => [
    // Items go here...
], 'admin');

Nav::items()

// or

navitems()

Nav::items('admin')

// or

navitems('admin')

Nav::toJson()

Nav::toJson('admin')

Nav::filter(fn (Item $item) => ...)

Nav::filter(fn (Item $item) => ..., 'app')
Nav::filter(fn (Item $item) => ..., 'admin')

Nav::activeWhen(fn (Item $item) => ...)

Nav::activeWhen(fn (Item $item) => ..., 'app')
Nav::activeWhen(fn (Item $item) => ..., 'admin')