datatable.directory codebase
https://datatable.directory/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
41 lines
1.2 KiB
<?php
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
use App\Models\Table;
|
|
use App\Models\User;
|
|
use Illuminate\Http\Request;
|
|
use MightyPork\Utils\Utils;
|
|
|
|
class DashController extends Controller
|
|
{
|
|
public function view(Request $request)
|
|
{
|
|
$dismiss = false;
|
|
if ($request->has('dismiss-greeter')) {
|
|
$dismiss = Utils::parseBool01($request->get('dismiss-greeter'));
|
|
\Cookie::queue('dismiss-greeter', $dismiss, 24*60*365*10);
|
|
return back();
|
|
}
|
|
|
|
$data['users'] = User::orderBy('updated_at', 'desc')
|
|
->withCount(['tables'])
|
|
->paginate(10, ['id', 'title', 'name', 'tables_count'], 'userPage')
|
|
->appends(\Input::except('userPage'));
|
|
|
|
$sort = Table::resolveSortType(\Input::get('tableSort'));
|
|
$data['sortOptions'] = Table::getSortOptions();
|
|
|
|
$data['tables'] = Table::forList()->tableSort($sort)
|
|
->paginate(10, ['*'], 'tablePage')
|
|
->appends(\Input::except('tablePage'));
|
|
|
|
$data['tableSort'] = $sort;
|
|
|
|
$data['showGreeter'] = !$dismiss && !$request->cookie('dismiss-greeter', false);
|
|
|
|
return view('welcome', $data);
|
|
}
|
|
}
|
|
|