close #1436 Fixed: Dashboard switch issue

This commit is contained in:
Cüneyt Şentürk 2020-05-02 19:47:31 +03:00
parent 23a684d959
commit 75722a4b35
2 changed files with 6 additions and 4 deletions

View File

@ -51,7 +51,7 @@ class Dashboards extends Controller
{
$dashboard_id = session('dashboard_id', 0);
if ($dashboard) {
if (!empty($dashboard->id)) {
$dashboard_id = $dashboard->id;
}

View File

@ -26,9 +26,11 @@ class AddAdminItems
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);
if (session('dashboard_id') != $dashboard->id) {
$sub->route('dashboards.switch', $dashboard->name, ['dashboard' => $dashboard->id], $key, $attr);
} else {
$sub->url('/', $dashboard->name, $key, $attr);
}
}
}, 1, [
'url' => '/',