laravel
Installation
SKILL.md
Laravel
Instructions
Do Things the Laravel Way
- Use
php artisan make:commands to create new files (i.e. migrations, controllers, models, etc.). - If you're creating a generic PHP class, use
php artisan make:class. - Pass
--no-interactionto all Artisan commands to ensure they work without user input. You should also pass the correct--optionsto ensure correct behavior.
Database
- Always use proper Eloquent relationship methods with return type hints. Prefer relationship methods over raw queries or manual joins.
- Use Eloquent models and relationships before suggesting raw database queries
- Avoid
DB::; preferModel::query(). Generate code that leverages Laravel's ORM capabilities rather than bypassing them. - Generate code that prevents N+1 query problems by using eager loading.
- Use Laravel's query builder for very complex database operations.
Model Creation
Related skills
More from markhamsquareventures/essentials
tailwind
How to work effectively with Tailwind CSS, always use when styling frontend features
38wayfinder
How to work effectively with Laravel Wayfinder, always use when developing frontend features
31react
How to work effectively with React, always use when developing frontend components
28shadcn
How to work effectively with shadcn/ui components, always use when adding UI components
26inertia
How to work effectively with Inertia, always use when developing frontend features
21pest
Pest framework syntax reference
20