Skip to content

Commit

Permalink
changed dashboard assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Jun 15, 2020
1 parent 1934b93 commit df03edc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions app/Http/Controllers/Auth/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ public function store(Request $request)
return response()->json($response);
}

session(['dashboard_id' => $user->dashboards()->enabled()->pluck('id')->first()]);

$response = [
'status' => null,
'success' => true,
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/Common/Dashboards.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@ public function show($dashboard_id = null)
{
$dashboard_id = $dashboard_id ?? session('dashboard_id');

if (empty($dashboard_id)) {
$dashboard_id = user()->dashboards()->enabled()->pluck('id')->first();
}

if (!empty($dashboard_id)) {
$dashboard = Dashboard::find($dashboard_id);
} else {
$dashboard = user()->dashboards()->enabled()->first();
}

if (empty($dashboard)) {
Expand All @@ -67,6 +65,8 @@ public function show($dashboard_id = null)
]));
}

session(['dashboard_id' => $dashboard->id]);

$widgets = Widget::where('dashboard_id', $dashboard->id)->orderBy('sort', 'asc')->get()->filter(function ($widget) {
return Widgets::canShow($widget->class);
});
Expand Down

0 comments on commit df03edc

Please sign in to comment.