Laravel Community Tools by Tighten

Recent tricks

458 tricks
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 9984
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 41152
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 20114
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 8975
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 9025
With database seeding you can fill your database with dummy data with simple command. I created code that will fill users table with some data. users table consists of three columns (username,email,biog).
Clivern 11 years ago 58031
For one of my projects I needed to get an ID of the previous and next record in the DB. This could go well with portfolios, orders, blog posts, all kinds of things where you need to display next/previous entry links. Let’s say we are logged in as an admin and we are on this user’s page and we want to see next/previous user’s id. The following Eloquent code makes it easy to do that. Enjoy!
msurguy 12 years ago 17063
logs a sql query with bindings replace by actual values
eugene_san... 12 years ago 9173
Using of the Bootstrap Error classes for flash message, one simple helper would help to simply to extend the flash messages.
yoosuf 12 years ago 17685