Reputation: 103
I'm new to Laravel and i'm working on social application and i want the generated routes be something like this :
-www.app.com/username
-www.app.com/username/boards
-www.app.com/username/boards/ID
-www.app.com/username/follower .. etc
Any help with that ?
Upvotes: 2
Views: 1230
Reputation: 87789
You can do things like this with Laravel's router:
Route::get('{username}/boards', 'BoardsController@show')
->where('username', '[A-Za-z]+');
And then you just need a controller:
class BoardsController extends Controller {
public function show($username)
{
return "showing boards for $username";
}
}
Upvotes: 3