Init
This commit is contained in:
23
Career/Resources/Laracast/Eloquent Performance Patterns.md
Normal file
23
Career/Resources/Laracast/Eloquent Performance Patterns.md
Normal file
@@ -0,0 +1,23 @@
|
||||
### Getting one recode from a has many relation
|
||||
addSelect(['value_name' => Model::whereColumn('a','table.b')->take(1)])
|
||||
|
||||
|
||||
|
||||
### Dynamic Relationships Using Subqueries
|
||||
The relation column can be added using a addSelect
|
||||
|
||||
### Calculate Totals Using Conditional Aggregates
|
||||
case exists
|
||||
|
||||
### Optimize Circular Relationships
|
||||
Manual set relation to the model instead of loading it again
|
||||
|
||||
### Getting LIKE to use an Index
|
||||
Dont use wildcards on both sides
|
||||
|
||||
### Use Unions to Run Queries Independently
|
||||
Where in
|
||||
derived table
|
||||
find users by x
|
||||
union
|
||||
find users by y
|
||||
Reference in New Issue
Block a user