<?php use Models\Models\User; $app->get('/users', function () use($app) { $user = User::all(); if ($user == false) { echo "hoi"; //$app->notFound(); } $app->render('users/users.php', ['users' => $user]); });
<?php use Models\Models\User; $app->get('/users/:username', function ($username) use($app) { $user = User::where('id', $username)->first(); if ($user == false) { $app->notFound(); } //$user = $app->db->table('users')->where('username', $username)->first(); $app->render('users/userinfo.php', ['user' => $user]); })->name('userinfo');
<?php use Models\Models\User; $app->get('/profile', function () use($app) { $id = $_SESSION['user_id']; $user = User::where('id', $id)->first(); if ($user == false) { $app->notFound(); } //$user = $app->db->table('users')->where('username', $username)->first(); $app->render('profile.php', ['user' => $user]); })->name('profile');