i want to undestrtand how can i setup my routes on the best way for not get collission on the future.
I would like have like first segment the username of the user showing the profile of that user.
Example: laravel.dev/user1
the problem is, if i have a route with the name register "example below" and a user put like username register of course happen a collission and is not sure on wich view is showed.
Route::get('register','UserController@getCreate');
I setup my main route for display the profile user like so:
Route::get('{cr_user}','WallController@getIndex'); // view profile
Route::bind('cr_user', function($value, $route) {
if($user = User::where('username', '=',$value)->first()) // check if exist the user other ways show 404 page
{
return $user;
}
App::abort(404);
});
The second problem of this setting of route is that i cannot set other route with just 1 segment. Example if i want set the route register i cannot do that without put any segment before but for do it work i have to put example: do/register.
any help?