changed dashboard assignment

This commit is contained in:
Denis Duliçi 2020-06-15 14:30:04 +03:00
parent 1934b93353
commit df03edcfff
2 changed files with 4 additions and 6 deletions

View File

@ -89,8 +89,6 @@ class Login extends Controller
return response()->json($response);
}
session(['dashboard_id' => $user->dashboards()->enabled()->pluck('id')->first()]);
$response = [
'status' => null,
'success' => true,

View File

@ -51,12 +51,10 @@ class Dashboards extends Controller
{
$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)) {
@ -67,6 +65,8 @@ class Dashboards extends Controller
]));
}
session(['dashboard_id' => $dashboard->id]);
$widgets = Widget::where('dashboard_id', $dashboard->id)->orderBy('sort', 'asc')->get()->filter(function ($widget) {
return Widgets::canShow($widget->class);
});