I am having a bit of trouble with the routing.
I'm working on a CMS, and I need two primary routes. /admin
and /(:any)
. The admin
controller is used for the route /admin
, and the view
controller should be used for anything else than /admin
. From the view
controller, I will then parse the url and show the correct content.
This is what I have:
Route::get(array('admin', 'admin/dashboard'), array('as' => 'admin', 'uses' =>'admin.dashboard@index'));
Route::any('(:any)', 'view@index');
The first route works, but the second one doesn't. I played around with it a little bit, and it seems if I use (:any)
without the question mark, it only works if I put something after /
. If i do put the question mark there, it doesn't work at all.
I want all of the following routes to go to view@index:
/
/something
/something/something
/something/something/something
/something/something/something/something
...etc...
Is this possible without hardcoding a bunch of (:any?)/(:any?)/(:any?)/(:any?)
(which I don't even know works)?
What's the best way to go about this?
/
anyways. Eg. if i want to view a subpage, i would go to/parent/subpage
, so i would need to parse that from theview
controller and display the correct page. I'm not sure which method is most appropriate for this kind of use, but i guess in the end it doesn't matter? – Preeminence