user landing page

This commit is contained in:
denisdulici
2020-01-21 11:59:52 +03:00
parent 61a6ea6687
commit 9f00e1a0d6
16 changed files with 99 additions and 38 deletions

View File

@@ -19,28 +19,30 @@ class AddAdminItems
$user = user();
$attr = ['icon' => ''];
// Dashboard
$dashboards = user()->dashboards()->enabled()->get();
// Dashboards
if ($user->can('read-common-dashboards')) {
$dashboards = $user->dashboards()->enabled()->get();
if ($dashboards->count() > 1) {
$menu->dropdown(trim(trans_choice('general.dashboards', 2)), function ($sub) use ($user, $attr, $dashboards) {
foreach ($dashboards as $key => $dashboard) {
$path = (session('dashboard_id') == $dashboard->id) ? '/' : '/?dashboard_id=' . $dashboard->id;
if ($dashboards->count() > 1) {
$menu->dropdown(trim(trans_choice('general.dashboards', 2)), function ($sub) use ($user, $attr, $dashboards) {
foreach ($dashboards as $key => $dashboard) {
$path = (session('dashboard_id') == $dashboard->id) ? '/' : '/?dashboard_id=' . $dashboard->id;
$sub->url($path, $dashboard->name, $key, $attr);
}
}, 1, [
'url' => '/',
'title' => trans_choice('general.dashboards', 2),
'icon' => 'fa fa-tachometer-alt',
]);
} else {
$menu->add([
'url' => '/',
'title' => trans_choice('general.dashboards', 1),
'icon' => 'fa fa-tachometer-alt',
'order' => 1,
]);
$sub->url($path, $dashboard->name, $key, $attr);
}
}, 1, [
'url' => '/',
'title' => trans_choice('general.dashboards', 2),
'icon' => 'fa fa-tachometer-alt',
]);
} else {
$menu->add([
'url' => '/',
'title' => trans_choice('general.dashboards', 1),
'icon' => 'fa fa-tachometer-alt',
'order' => 1,
]);
}
}
// Items