"When I use joins I get soft-deleted records, why does this happen?"
The first time you learn how to use the Eloquent ORM, the examples you encounter are for simple apps (ie: a simple CRUD website), which is fine, but you might find yourself struggling when you have to do something more complex than simply filtering result by one field or getting a model by its id.
Everyone always says to just read the docs (you should do that), but it's hard to know what to search for in the docs if you don't understand how Eloquent works and how the different parts of Eloquent fit together.
Wouldn't it be nice to understand what's happening when you make a query?
That's why I decided to write this book.
Table Of Contents
-
The Laravel Query Builder
-
How does it work?
- Bindings
- Raw queries
-
Subqueries
- Aggregates
-
How does it work?
-
Eloquent
- What's an ORM?
-
What's the relationship between Eloquent and the query builder?
- Where is the where?
- Magic methods
- Back to the model
- The Eloquent Query Builder
-
Why choose Eloquent over the query builder
- Differences
- Benefits of Eloquent
- Drawbacks of Eloquent
-
Working with Pivot Tables
- Basic Usage
-
Adding timestamps
- Ordering by a pivot table
- Adding more fields to the pivot table
- Pivot table models
-
Scopes
-
Local scopes
- How to define a local scopes
- Combining local scopes
- Or where scope
-
Global scopes
- Disable Global Scopes
- Soft Deletes: Laravel's use of global scopes
-
Local scopes
-
Aggregates
- Basic use
-
Aggregates and Eloquent relations
- Other aggregate functions
- Aggregates using group by and raw queries
-
Joins
- Inner Join
- Left And Right Joins
- Cross joins
- Filtering with joins
- Should you use joins with Eloquent?