PHP code example of italia / design-laravel-theme

1. Go to this page and download the library: Download italia/design-laravel-theme 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/ */

    

italia / design-laravel-theme example snippets


    italia\DesignLaravelTheme\ServiceProvider::class,
    

'menu' => [
    'slim-header' => [],
    'header' => [],
    'footer' => [],
    'footer-bar' => [],
],

'menu' => [
        'slim-header' => [
            [
                'url' => '#',
                'text' => 'Pagina iniziale',
            ],
            [
                'url' => '#',
                'text' => 'Contatti',
                'target' => '_blank',
            ],
        ],
        ...
]        

'menu' => [
        'footer-bar' => [
            [
                'url' => '#',
                'text' => 'Privacy policy',
            ],
            [
                'url' => '#',
                'text' => 'Contatti',
                'target' => '_blank',
            ],
        ],
        ...
]        

'menu' => [
        ...
        'footer' => [
                    [
                        [
                            'text' => 'Amministrazione',
                            'url' => '#',
                            'target' => '_blank',
                        ],
                        [
                            'text' => 'Giunta e consiglio',
                            'url' => '#',
                        ],
                    ],
                    [
                        [
                            'text' => 'Amministrazione',
                            'url' => '#',
                        ],
                        [
                            'text' => 'Giunta e consiglio',
                            'url' => '#',
                        ],
                    ],
                ],
]        

[
    'url' => '/home',
    'text' => 'Home',
    'target' => '_blank',
],

[
    'url' => '/home',
    'text' => 'Dropdown item',
    'dropdown' => [
        'Intestazione',
        [
            'url' => '/home',
            'text' => 'Home',
            'target' => '_blank',
        ],
        '-',
        [
            'url' => '/about',
            'text' => 'About',
        ],
],

[
    'text' => 'Megamenu item',
    'megamenu' => [
        [
            'Heading 1',
            [
                'url' => '/home',
                'text' => 'Home',
                'target' => '_blank',
            ],
            '-',
            [
                'url' => '/about',
                'text' => 'About',
            ],
        ],
        [
        'Heading 2',
            [
                'url' => '/a',
                'text' => 'Link a',
            ],
            '-',
            [
                'url' => '/b',
                'text' => 'Link b',
            ],
        ],
    ]
],

[
    [
        'text' => 'Create request',
        'url' => 'request/new',
        'can' => 'create-request'
    ],
]



namespace MyApp;

use italia\DesignLaravelTheme\Menu\Builder;
use italia\DesignLaravelTheme\Menu\Filters\FilterInterface;
use Laratrust;

class MyMenuFilter implements FilterInterface
{
    public function transform($item, Builder $builder)
    {
        if (isset($item['permission']) && ! Laratrust::can($item['permission'])) {
            return false;
        }

        return $item;
    }
}

'filters' => [
    italia\DesignLaravelTheme\Menu\Filters\HrefFilter::class,
    italia\DesignLaravelTheme\Menu\Filters\ActiveFilter::class,
    //italia\DesignLaravelTheme\Menu\Filters\GateFilter::class, Comment this line out
    MyApp\MyMenuFilter::class,
]

use Illuminate\Contracts\Events\Dispatcher;
use italia\DesignLaravelTheme\Events\BuildingMenu;

class AppServiceProvider extends ServiceProvider
{

    public function boot(Dispatcher $events)
    {
        $events->listen(BuildingMenu::class, function (BuildingMenu $event) {
            $event->menu->add_slim_header([
                            'text' => 'Blog',
                            'url' => 'admin/blog'
                        ]);
            $event->menu->add_header([
                            'text' => 'Blog',
                            'url' => 'admin/blog',
                        ]);
        });
    }

}

    public function boot(Dispatcher $events)
    {
        $events->listen(BuildingMenu::class, function (BuildingMenu $event) {            

            $items = Page::all()->map(function (Page $page) {
                return [
                    'text' => $page['title'],
                    'url' => route('admin.pages.edit', $page)
                ];
            });

            $event->menu->add_slim_header(...$items);
        });
    }

[
    'text' => 'Pages'
    'url' => 'pages',
    'active' => ['pages', 'content', 'content/*']
]

    php artisan vendor:publish --provider="italia\DesignLaravelTheme\ServiceProvider" --tag=assets
    

    php artisan vendor:publish --provider="italia\DesignLaravelTheme\ServiceProvider" --tag=assets --force
    

php artisan make:bootstrapitalia

php artisan vendor:publish --provider="italia\DesignLaravelTheme\ServiceProvider" --tag=config

php artisan vendor:publish --provider="italia\DesignLaravelTheme\ServiceProvider" --tag=translations

php artisan vendor:publish --provider="italia\DesignLaravelTheme\ServiceProvider" --tag=views