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/ */
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);
});
}