Laravel Community Tools by Tighten

Tag "eloquent" tricks

24 tricks
laravel globale search
hamdiantar 2 years ago 19871
Easy way to create many filters aggregated in Eloquent with query string
wallacemax... 4 years ago 24180
Save yourself from all the boilerplate of tracking/observing and reacting to model attribute changes.
alexstewar... 4 years ago 12893
This query searches the data from the Table and also with its relation table columns dynamically.
Muzamil-kh... 4 years ago 10052
Get products count which are under sub categories of a parent category
Faridbabay... 4 years ago 11380
Using laravel eloquent, you have an amazing feature called `Accessors`, which allows you to define a non-existing column, here's an example to get user full_name that does not exist in the users table
thefeqy 4 years ago 15758
If you have DB column which you want to be set only once and never updated again, you can set that restriction on Eloquent Model, with a mutator
fatihtopra... 5 years ago 17612
What if you’re working with non-Laravel database and your timestamp columns are named differently? Maybe, you have create_time and update_time. Luckily, you can specify them in the model, too
fatihtopra... 5 years ago 14984
You can filter by NULL in Eloquent, but if you're filtering the collection further - filter by empty string, there's no "null" in that field anymore.
fatihtopra... 5 years ago 15208