Laravel Community Tools by Tighten

Tag "4.1" tricks

72 tricks
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 12806
4.1
Here is how to beat Laravel to the punch when the database isn't playing nice. The error codes are specific to MySQL. You can easily substitute the error codes for whatever DB you are using. Below are 2 common errors. Here's a scrrenshot of the error page plus.google.com/113701899574492909448/posts/c4oAn7FDmLj
DragonI 11 years ago 11992
Get a real-time view of all the currently executing queries.
mcraz 11 years ago 27368
This is my step on how to install laravel outside public_html
amirolahma... 11 years ago 29444
Sometimes you want to paginate a table in an order, but when showing the items you need to reverse the order. Using the array_reverse on Paginator wont work, but if you use the getItems() its possible.
diegofelix 11 years ago 9991
Sometimes you might want to delete/update a whole lot of items that are related to a model when a record under that model is deleted from the database. This could be useful for various scenarios when there is a lot of processing that needs to be done upon model deletion. Laravel provides model events that you can use in that case.
msurguy 11 years ago 41165
This is a simple trick that laravel run on IIS Server, this configuration will delete the public folder from the URL, but does not delete the public folder in the application. I was inspired by a trick-owned https://gist.github.com/leabdalla/6135627, but it can not load css, js, routing and other files. And I have experimented that overall laravel can run normally. this is my simple code, I put web.config in the root folder, and I did not change any of the main application, especially in public folders.
cyberid41 11 years ago 20121
4.1
Sometimes you need to use some packages based on the environment in which the application is running in, for example "development". You can append environment service providers and aliases in your development configuration file "app/config/development/app.php" with the "append_config" helper method.
hosmelq 11 years ago 8981
4.1
It's possible to add condition to your model's relationships... Help me to use Eloquent with a legacy database..
Matt 11 years ago 9034