Add sort dropdown to profile pages

This commit is contained in:
2018-08-20 22:09:22 +02:00
parent 4392ab9d7b
commit 6b04218f67
6 changed files with 111 additions and 81 deletions
+9 -7
View File
@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Models\Table;
use App\Models\User;
use Illuminate\Http\Request;
@@ -18,14 +19,15 @@ class ProfileController extends Controller
*/
public function view(User $user)
{
$tables = $user->tables()->forList()->orderByDesc('updated_at')->paginate(10);
$tables_count = $user->tables()->count();
$data['user'] = $user;
$data['tables_count'] = $user->tables()->count();
return view('profile.view')->with(compact(
'tables',
'user',
'tables_count'
));
$data['tableSort'] = $sort = Table::resolveSortType(\Input::get('tableSort'));
$data['sortOptions'] = Table::getSortOptions();
$data['tables'] = $user->tables()->forList()->tableSort($sort)->paginate(10);
return view('profile.view', $data);
}
/**