Laravel Laravel 11+ / PHP 8.2+
Laravel Quick Reference
Essential Laravel Artisan commands, routing, Blade directives, Eloquent relationships, validation, Sanctum auth, and production optimization.
php artisan make:model Post -mcr; Post::with('author')->paginate(15);
Core Laravel & Artisan Cheat Sheet
| Concept | Syntax / Command |
|---|---|
| Model + Migration + Resource Controller | php artisan make:model Post -mcr |
| Run migrations | php artisan migrate |
| Eager load (avoid N+1) | Post::with('author')->latest()->paginate(15) |
| Blade escaped output | {{ $user->name }} |
| CSRF form directive | @csrf inside every POST/PUT/DELETE form |
| Form Request validation | php artisan make:request StorePostRequest |
| API Resource | php artisan make:resource PostResource |
| Production cache warm | php artisan optimize |