I'm laravel newbie, I have written a simple code:
Route::get('users/{uname}/{uid}', function($uname, $uid)
{
$u = DB::table('users')->where('login', $uname)->first();
return View::make('users',
array(
'username' => $u->login,
'userid' => $u->uid
)
);
});
I have 2 questions regarding this code,
First: Is this code valid?
Second: How can I show 404 error when query is not found? For example if I write site.com/users/badusername/badid then show 404 error, not blank page.
Thanks in advance !
P.S how can i make $u query to two wheres? For example WHERE login = ? AND uid = ?