Laravel Community Tools by Tighten

Tag "models" tricks

58 tricks
You can unguard all your Models instead of setting the protected guarded variable to an empty array in each App\Models\YourModel class using Model::unguard() in the boot method of AppServiceProvider class.
berto309 5 years ago 24327
Make your dynamic post caching for load your website post fast.
haruncpi 5 years ago 8447
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 12070
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 11915
Sometimes you need to want tables columns as array while you editing the data, this will return a columns as array.
decipher 8 years ago 4437
Title : Access Control Allow Origin http set Headers Site Name : http://live24u.com/ URL : http://live24u.com/access-control-allow-origin-http-set-headers/ Live Example : http://live24u.com/tutorial/ We are Web Technology Experts and Team who provide you very Important information on Web Development information, Interview Questions and Answers, live project problem solution and their solution and online free tutorials – “live24u.com”.
live24u 8 years ago 7391
This example provides a quick and simple method to generate a hash for a model without saving a UUID/GUID to the database.
Donny5300 9 years ago 8248
Automatically deleting related rows in Laravel (Eloquent ORM)
dickyeka 9 years ago 30485
I'm using a pivot table on the project I'm working with to filter category
dickyeka 9 years ago 9399