Hey, i have this route
Route::get('report/{id?}', array('as' => 'report', function($id = null) { return View::make('public.report')->with('target', $id); }));
and i want to have a view for /report, and a different view for /report/{id}. How can i do that
Make a second route Route::get('report
, ....`.
And remove the ?
from Route::get('report/{id?}'
Also, think about using controllers instead of writing everything in the routes file. Just a suggestion
@XoneFobic Thanks. And i think just for displaying a view, there is no need for a controller.
@Joe96, you are right. For a view it's probably ok, I do still like to keep things in a certain design pattern. Keeps the routes file nice and tidy :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community