How to Fetch (and Restore) Soft-Deleted Records in Laravel
withTrashed(), onlyTrashed(), and restore() — plus the query-scope gotcha that makes soft-deleted rows silently vanish from relationships by default.
GUIDES
withTrashed(), onlyTrashed(), and restore() — plus the query-scope gotcha that makes soft-deleted rows silently vanish from relationships by default.
Laravel's Http facade wraps Guzzle under the hood, offering a genuinely more readable fluent syntax than raw cURL or the earlier GuzzleHttp\Client instantiation pattern for the exact same underlying request.
whereDate, whereBetween, and raw Carbon comparisons in Eloquent — which one to use and the timezone mistake that causes off-by-one-day bugs.
Adding a column, changing its type, renaming it, dropping a foreign key, or rolling back a specific migration — the everyday migration operations in one reference.
Seeders populate the database with sample or default data — combined with factories, they're what makes a fresh local environment usable in seconds instead of requiring manual data entry.
belongsTo, hasMany, hasOne, joins, and the aggregate methods (sum, avg, min, max, count) — the building blocks for querying related data in Eloquent.
Three small, specific Eloquent patterns that come up often enough to be worth knowing directly rather than re-deriving each time.
The where-family methods cover most of what you need to filter Eloquent queries — this reference covers the syntax for each variant in one place.
Rollback only ever runs a migration's down() method — if that method was never written correctly (or at all), rollback either does nothing or fails outright, regardless of how the up() method itself behaved.
whereHas() filters parent records by a condition on their related data without ever actually joining tables — a genuinely different mechanism from join(), even though both can produce a similar-looking result.
A factory generates realistic fake data at scale; a seeder decides what to actually create and in what order — the two are complementary tools, not interchangeable alternatives to each other.
Laravel leftJoin preserves unmatched left rows only until a right-table WHERE condition filters them out; put match criteria in ON when the outer join must remain outer.