Jhourlad Estrella
Jhourlad Estrella

Reputation: 3670

Laravel 5: Handling Dynamic and Static routes

Is there a way in Laravel5 where I could define routes that handles dynamic routes without conflicting with current static routes? Something similar below:

// Dynamic routes
Route::get('{permalink}', function($permalink) {
   //look for matching username on the table (bind perhaps?)
});

// Static routes
Route::get('home', 'HomeController@index');
Route::get('products', 'ProductController@index');

Any ideas, guys? Thanks.

Upvotes: 4

Views: 612

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163768

Static and dynamic routes shouldn't conflict with each other. Just put static routes higher than dynamic ones.

Upvotes: 5

Related Questions