Laravel Community Tools by Tighten

Category "Eloquent" tricks

140 tricks
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 11889
If You're raning Laravel 5.4, You May Get An Error While You'are Migrate Or Dealing with the db . The Error is look like : [Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email)) [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
AdeLDev 7 years ago 9018
5.4
You might come up with a situation where you want to check if a given Eloquent attribute was changed compared with its original stored value.
laraning 7 years ago 25106
with this trait you can get Enum values of a table /
nimahkh 7 years ago 12626
If you ever wanted to see the SQL query that is being generated when using the Eloquent or the Query Buider, you can simply use to `toSql` method.
wilburpowe... 8 years ago 3666
The array_add function adds a given key / value pair to the array if the given key doesn't already exist in the array.
jobayerfx 8 years ago 5995
5.0
This is the trick i use whenever i want to seed states or countries. I simply put the states inside an array and create a loop through the array and save each record into the database instead of repeating the instance to save the records.
Adewagold 8 years ago 13183
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 7378