|
|
|
@ -20,7 +20,9 @@ class DashController extends Controller |
|
|
|
|
return back(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$data['tableSort'] = $sort = \Input::get('tableSort', 'last-updated'); |
|
|
|
|
$defaultSort = 'last-updated'; |
|
|
|
|
|
|
|
|
|
$sort = \Input::get('tableSort', $defaultSort); |
|
|
|
|
|
|
|
|
|
$data['sortOptions'] = [ |
|
|
|
|
'most-visited' => 'Most Visited', |
|
|
|
@ -34,6 +36,12 @@ class DashController extends Controller |
|
|
|
|
'least-rows' => 'Shortest', |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
if (!in_array($sort, array_keys($data['sortOptions']))) { |
|
|
|
|
$sort = $defaultSort; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$data['tableSort'] = $sort; |
|
|
|
|
|
|
|
|
|
$data['users'] = User::orderBy('updated_at', 'desc') |
|
|
|
|
->withCount(['tables']) |
|
|
|
|
->paginate(10, ['id', 'title', 'name', 'tables_count'], 'userPage') |
|
|
|
|