Tutorials for Developers & Sysadmins

Step-by-step guides for the work we actually do — Laravel, PHP, WordPress, MySQL, Linux servers, and the occasional rabbit hole. Every command has been run on a real machine; nothing is theoretical.

Laravel Nullable Exists Validation (nullable, sometimes, present)

Laravel nullable exists validation: use nullable|exists for optional foreign keys, sometimes for absent keys, and present for strict APIs. Covers…

how7o

How to Rollback a Specific Migration in Laravel

Laravel rollback specific migration with migrate:rollback --path or --step. Covers migrate:status, the --path relative-path rule, and the migrate:fresh warning.

how7o

How to Do a Left Outer Join in Laravel Query Builder

Perform a laravel left outer join with the query builder: basic syntax, closure conditions, leftJoinSub for subqueries, and when to…

how7o

How to Retrieve the Last Inserted ID in Laravel Eloquent

Get the laravel last inserted id the right way: read $model->id after save/create, use latest('id')->first(), or insertGetId(). Avoid the all()->last()…

how7o

How to Get Records Created Today in Laravel

Query laravel eloquent records today with whereDate + Carbon::today(), a Carbon-free variant, and an index-friendly whereBetween range for large tables.

how7o

How to Get Current Month Records in Laravel Eloquent

Query Laravel Eloquent current month records three ways: whereMonth+whereYear, Carbon, and the index-friendly whereBetween range. Includes timezone fix.

how7o

How to Count Records Grouped By a Column in Laravel Eloquent

Use laravel eloquent group by count with select + DB::raw, fix ONLY_FULL_GROUP_BY errors, and filter groups with havingRaw. Working examples…

how7o

How to Count Rows in Laravel Eloquent Efficiently

Learn how to laravel eloquent count rows efficiently: count(), withCount() for relationships, count(column) for NULLs, and distinct counts.

how7o

How to Delete a Record with Laravel Eloquent (4 Methods)

Four ways to laravel eloquent delete record: find-and-delete, destroy by key, mass where-delete, and forceDelete for soft-deleted rows with examples.

how7o

How to Combine Multiple where() and orWhere() in Laravel Eloquent

Fix laravel eloquent multiple where orwhere bugs with closure grouping. Learn precedence pitfalls, nested groups, and the Laravel 10.47+ whereAny…

how7o