← Back to Laravel SaaS foundation team
See how it helps
Idiomatic Laravel implementation
Uses existing Laravel conventions to give validation, authorization, business rules and HTTP handling clear responsibilities.
laravel-conventions
Team members using this skill
When is it useful?
Use when adding functionality that should fit the application's structure without unnecessary architectural layers.
What does it help you do?
- Keeps controllers focused and places business rules in the project's established layer.
- Uses dependency injection and configuration that works with cached settings.
- Follows named routes, explicit types and consistent exception handling.
Try asking this
Implement order cancellation using our existing action pattern, policy and Form Request, including an actionable conflict response. Attempt cancellation before and after shipment. Return the existing response format, preserve shipped records and expose a conflict the caller can explain to the user.
Detailed documentation
Read the skill’s original instructions, examples and checks in their authored language.
Show less
Idiomatic Laravel Development
Architecture and responsibilities
- Keep controllers focused on HTTP orchestration: receive a validated Form Request, authorize the action, delegate non-trivial business rules to the layer the project uses (domain methods, Action classes or Services), and return a response, View, Redirect or JsonResource.
- Separate input validation, authorization and business rules so each has one clear home and can run in HTTP, CLI and queue contexts.
- Do not introduce repositories, service layers or interfaces with a single implementation unless the project already uses that pattern or the complexity warrants it.
- Generate scaffolding with
php artisan make:*(--no-interaction) so namespaces and stubs match the app. Never edit files invendor/.
Container, config and environment
- Prefer constructor dependency injection and typed contracts over
app()service location in application code. Register bindings and singletons in Service Providers. - Call
env()ONLY insideconfig/*.php; in application code always readconfig('service.key')becauseenv()returnsnullwhen config is cached. Document new environment variables in.env.example.
Routing, errors and PHP style
- Use named routes (
route('orders.show', $order)), route model binding, andRoute::resource/Route::apiResourcewhere CRUD fits. - Use custom domain exceptions (
report()/render()or centralized exception handling inbootstrap/app.php/Handler.php) instead of catching generic\Exceptionand returning ad-hoc error arrays. - Add explicit parameter and return types, constructor property promotion, and PHP BackedEnums (
stringorint) for status/type sets. Format withvendor/bin/pint --dirtywhen Pint is present.
Included files 2
LICENSE.txtSKILL.md
