Laravel Community Tools by Tighten

Popular tricks

458 tricks
An example of how I did my filters.php and routes.php to populate many of the same structured routes. Used Sentry 2 for Authentication and short syntax for array() Suggestions to make it even DRYer are welcome. php artisan route output of the example http://paste.laravel.com/1cnE
XoneFobic 12 years ago 12546
Reference the connection by name, the database could be named differently in another environment.\ Note: you might want to add backticks to the database name if the name uses alternative characters.
orlissenbe... 11 years ago 12563
Sometimes you would like to restrict a certain route parameter. For instance, if you are using route parameters to determine the ID of a certain model you are using, you would only like digits to be passed, not alphabetical characters. You can set these restrictions on the route using ->where('<pattern>'). But what if you have a huge list of routes that all use the same pattern restriction? That's where this will come in handy.
stidges 12 years ago 12271
If you want to count the number of results from a relationship without actually loading them you may use the "withCount" method, which will place a "{relation}_count" column on your resulting models.
kupendra 6 years ago 12173
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 12 years ago 12124
FastAPI-inspired attribute-based routing to Laravel, simplifying the way routes, methods, and middlewares are defined. With this package, you can group routes using the FastAPIGroup attribute, set middleware directly on controllers, and specify HTTP methods and paths using attributes like FastAPI. This elegant approach allows developers to write cleaner, more organized, and maintainable route definitions, offering a powerful alternative to traditional Laravel routing.
mustafakha... 1 year ago 12133
It's a bit tricky to figure out exactly where to put a breakpoint to quickly check your final sql statement before execution. This is for 4.2 but may be similar in
sgelbart 9 years ago 12122
A simple setup for create an artisan make:repository command See more https://github.com/sexym0nk3y/Laravel-5.3-Repository
sexym0nk3y 9 years ago 12095
If you want your search functionality to be dynamic as possible to avoid code repetitions, you can use this trait directly in your models
kissartisa... 7 years ago 12073