Laravel Community Tools by Tighten

Popular tricks

458 tricks
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 12680
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 12620
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 12636
Laravel State Management is a powerful, Redux-inspired solution for managing complex application state across services, requests, and caching layers. This package allows you to define shared state, easily persist and rehydrate data, and implement custom methods for state manipulation. With features like attribute casting, default state handling, and global store access, it provides a robust system for managing state across your Laravel app.
mustafakha... 1 year ago 12502
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 12350
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 7 years ago 12280
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 12229
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 12225
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 12205