Laravel Community Tools by Tighten

Category "Routing" tricks

91 tricks
This filter will prevent the route from having sessions enabled. Very useful for API calls and when you don't want sessions starting. Blog Post: http://dor.ky/laravel-prevent-sessions-for-routes-via-a-filter/
ssx 11 years ago 11305
sometime we need to autocomplete one input area and based on the value of this input area we sometime populated a dynamic dropdown . I thought it worth sharing .
hassanjama... 11 years ago 35596
I happened across a function in Laravel's Command class. This command is Command::table(); Have you ever wanted to build a table in the same fashion that the 'routes' command does? Well, this function is how to do it! I couldn't find any real documentation on the method so just had a quick tinker with it and figured out it's usage. Here is an example of how to use it. Hopefully this might give the function some exposure, because at the moment, the web is lacking any!
Azirius 11 years ago 9097
Ever wanted to route pretty SEO urls to a controller with a specific ID without having to query the DB every time to match the URL to the page? On a number of projects previously, I've created cached versions of route files so that we can save all the URLs for a site and cut down on DB queries to work out what item we're viewing. Create another routes file that you write to whenever an entry is saved. You may end up with a lot of entries in the file, as each route will be for an individual item. Pass the ID to your controller action via the route like so:
Brunty 11 years ago 12808
4.1
On many occasions, I use the subdomain to generate dynamic routes and a custom user experience. The current Laravel subdomain filter, requires a lot of extra work when generating routes. Each time you generate a route, using the laravel route() helper, you have to pass the subdomain as the first parameter. This provides an alternative method without having to pass the subdomain to route(). https://github.com/laravel/laravel/issues/2515 for additional follow-up
jaketoolso... 11 years ago 46996
This is my step on how to install laravel outside public_html
amirolahma... 11 years ago 29445
Route::filter() passes multiple filter params as individual values like function($route, $response, $param1, $param2 ...) this is an easy way to check against multiple params. If I'm checking permissions like this ->before('permission:user,moderator') this makes it easy to check against. Since Route::filter() passes $route and $response in a BEFORE filter the array_slice strips them out of the array to allow you to check against the values you want.
bgallagh3r 12 years ago 8451
Catch all routes and paths using the auth filter. A route validation method is added to the Users model called hasAccess($route) and returns true if the user has that route. If the user doesn't have the route the error message will inform of what access they are missing.
somadden 12 years ago 9870
We have released the source code of this website! You can check out the repository containing a mirror copy of this website: https://github.com/CodepadME/laravel-tricks to create your own websites like Laravel-tricks. It uses PSR-2 coding standards, a ton of libraries and packages and is a good resource to take a look into.
msurguy 12 years ago 9641