I need to fetch the data from database and display it view . This is my web.php
Route::get('/businesscard/{name}', function ($name) {
//$username= App\users::where('username', $name);
$username=DB::table('users')->select('*')
->where('username', '=', $name)
// ->groupBy('status')
->get();
return view('auth.pro')->with(['username' => $username]);
return array(
'name' => $name
);
});
If the user enters domain.com/businesscard/username I need to fetch the data for the username and display it in view .It is working.But I need to remove businesscard .User need to enter domain.com/username. I have tried the below code.
Route::get('/{name}', function ($name) {
//$username= App\users::where('username', $name);
$username=DB::table('users')->select('*')
->where('username', '=', $name)
// ->groupBy('status')
->get();
return view('auth.pro')->with(['username' => $username]);
return array(
'name' => $name
);
});
If there is data it is working .but other pages are not working like login and register .Users are entering their username in registration .
/{name}That means, /login, /register wont work.