i am new to laravel and i am having trouble getting the user info by going to the route 'user/{username}';
theoretically it should work, this is my route:
Route::get('/user/{username}', function($username){
$user = User::where('username',$username) -> first();
if(isset($user['username'])){
return redirect()->route('/user/'.$username, ['user' => $user]);
}else{
return redirect()->route('/user/'.$username, ['error' => 'This User Does Not Exist']);
}
});
i did use App\User;
in the page so it should work. i am getting this error:
NotFoundHttpException in RouteCollection.php line 161:
Any help is appreciated, thank you, please let me know if u need any more information in order to help.