Support the ongoing development of Laravel.io →
posted 9 years ago
Requests
Last updated 2 years ago.
0

I hacked into L4 a bit today trying to see if a route could be cached the way they are doing caching in L5, which would be another option in the future.

I was not successful at caching a route object. The route object can have no closures because of the inalienability to serialize a closure. In L5 the route object is trimmed down and has no closures in its base object code which allows for it to be serialized then just loaded and used as a route object.

Now in L4 if you remove any closures from the routes.php and use controllers, it still sets a closure on the the action['uses'] by default. So far everything I tried to replace that failed. I'm sure it could be done, but it would take a lot more modification to the core to get it to work. However it was fun and now I understand L5 routing a little better.

You could try using Route::Groups .. I already shutdown my Dev stuff or I'd check, but I think the Route::Group sub-routes are not parsed if the group is not a match to the request, but not 100% on that.

Last updated 2 years ago.
0

Another possibility for you to trim your route loading.

if (Request::is('admin/*'))
{
    require __DIR__.'/admin_routes.php';
}

from http://laravel-news.com/2014/04/laravel-tip-break-up-your-routes/

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

sacepums sacepums Joined 13 Oct 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.