Lara Dashboard Laravel Development Guidelines
Complete development guidelines for Lara Dashboard CMS - a comprehensive Laravel-based content management system with Tailwind, Livewire, REST API, and full enterprise features including user management, roles, permissions, modules, settings, translations, and monitoring.
Laravel Boost MCP Integration
Core Tools
Laravel Boost is an MCP server with powerful tools designed specifically for this applicationUse the `list-artisan-commands` tool before calling Artisan commands to verify available parametersUse the `get-absolute-url` tool when sharing project URLs to ensure correct scheme, domain/IP, and portUse the `tinker` tool for executing PHP to debug code or query Eloquent models directlyUse the `database-query` tool for read-only database operationsBrowser Debugging
Use the `browser-logs` tool to read browser logs, errors, and exceptionsFocus only on recent browser logs - ignore old logsDocumentation Search (Critical)
Always use the `search-docs` tool before other approachesTool automatically passes installed packages and versions to remote Boost APIReturns only version-specific documentation for your exact circumstancePerfect for Laravel ecosystem: Laravel, Inertia, Livewire, Filament, Tailwind, Pest, Nova, NightwatchUse multiple, broad, topic-based queries: `['rate limiting', 'routing rate limiting', 'routing']`#### Search Syntax
Simple word searches with auto-stemming: `authentication` finds 'authenticate' and 'auth'Multiple words (AND logic): `rate limit` finds both "rate" AND "limit"Quoted phrases (exact position): `"infinite scroll"` - words must be adjacent in orderMixed queries: `middleware "rate limit"` - "middleware" AND exact phrase "rate limit"Multiple queries: `["authentication", "middleware"]` - ANY of these termsLaravel Core Best Practices
File Creation
Use `php artisan make:` commands for new files (migrations, controllers, models, etc.)For generic PHP classes, use `artisan make:class`Pass `--no-interaction` to all Artisan commandsInclude correct `--options` for proper behaviorDatabase Operations
Always use proper Eloquent relationship methods with return type hintsPrefer relationship methods over raw queries or manual joinsUse Eloquent models and relationships before raw database queriesAvoid `DB::`; prefer `Model::query()`Prevent N+1 query problems using eager loadingUse Laravel's query builder for very complex database operationsModel Development
When creating models, also create factories and seedersCheck `list-artisan-commands` for available `php artisan make:model` optionsAPIs & Resources
Default to Eloquent API Resources and API versioningFollow existing application conventions if differentControllers & Validation
Always create Form Request classes for validation rather than inline validationInclude both validation rules and custom error messagesCheck sibling Form Requests to see if application uses array or string-based validation rulesAdditional Best Practices
Use queued jobs with `ShouldQueue` interface for time-consuming operationsUse Laravel's built-in authentication and authorization (gates, policies, Sanctum)Prefer named routes and `route()` function for URL generationUse environment variables only in config files - never `env()` directlyAlways use `config('app.name')`, not `env('APP_NAME')`Laravel 12 Specific Guidelines
Project Structure
This project upgraded from Laravel 10 without migrating to new streamlined structureFollow existing Laravel 10 structure (recommended by Laravel)Middleware in `app/Http/Middleware/`, service providers in `app/Providers/`No `bootstrap/app.php` application configuration: - Middleware registration: `app/Http/Kernel.php`
- Exception handling: `app/Exceptions/Handler.php`
- Console commands/schedule: `app/Console/Kernel.php`
- Rate limits: `RouteServiceProvider` or `app/Http/Kernel.php`
Database Features
When modifying columns, include ALL previously defined attributes or they'll be lostLaravel 11+ allows native eager loading limits: `$query->latest()->limit(10)`Models
Use `casts()` method rather than `$casts` property (follow existing conventions)Livewire Development
Core Principles
Use `php artisan make:livewire [Posts\\CreatePost]` for new componentsState lives on server, UI reflects itAll Livewire requests hit Laravel backend - always validate and authorizeBest Practices
Components require single root elementUse `wire:loading` and `wire:dirty` for loading statesAdd `wire:key` in loops:```blade
@foreach ($items as $item)
<div wire:key="item-{{ $item->id }}">
{{ $item->name }}
</div>
@endforeach
```
Use lifecycle hooks for initialization and reactive side effects:```php
public function mount(User $user) { $this->user = $user; }
public function updatedSearch() { $this->resetPage(); }
```
Livewire 3 Features
Use `wire:model.live` for real-time updates (`wire:model` is deferred by default)Components use `App\Livewire` namespace (not `App\Http\Livewire`)Use `$this->dispatch()` for events (not `emit` or `dispatchBrowserEvent`)Use `components.layouts.app` view as typical layout pathAvailable directives: `wire:show`, `wire:transition`, `wire:cloak`, `wire:offline`, `wire:target`Alpine.js included automatically with plugins: persist, intersect, collapse, focusTesting Livewire
```php
Livewire::test(Counter::class)
->assertSet('count', 0)
->call('increment')
->assertSet('count', 1)
->assertSee(1)
->assertStatus(200);
// Testing component exists within page
$this->get('/posts/create')
->assertSeeLivewire(CreatePost::class);
```
Tailwind CSS Guidelines
Core Principles
Use Tailwind CSS classes to style HTMLCheck existing conventions before writing custom stylesExtract repeated patterns into components matching project conventionsThink through class placement, order, priority, and defaultsRemove redundant classes, group elements logicallySpacing
Use gap utilities for spacing, not margins:```html
<div class="flex gap-8">
<div>Superior</div>
<div>Michigan</div>
<div>Erie</div>
</div>
```
Dark Mode
Support dark mode using `dark:` prefix if existing components doTailwind 4 Specifics
Import using CSS `@import` statement:```css
@import "tailwindcss";
```
#### Replaced Utilities
| Deprecated | Replacement |
|------------|-------------|
| bg-opacity-* | bg-black/* |
| text-opacity-* | text-black/* |
| border-opacity-* | border-black/* |
| flex-shrink-* | shrink-* |
| flex-grow-* | grow-* |
| overflow-ellipsis | text-ellipsis |
Testing Requirements
Test Enforcement
Every change must be programmatically testedWrite new tests or update existing testsRun affected tests to ensure they passUse `php artisan test` with specific filename or filter for speedTesting Best Practices
Use model factories for test model creationCheck for custom factory states before manual setupUse `$this->faker->word()` or `fake()->randomDigit()` following existing conventionsCreate feature tests with `php artisan make:test [options] <name>`Use `--unit` flag for unit testsMost tests should be feature testsCode Quality
Laravel Pint
Run `vendor/bin/pint --dirty` before finalizing changesEnsures code matches project's expected styleDon't run `--test`, simply run `vendor/bin/pint` to fix formatting issuesError Handling
If you get "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest"Run `npm run build` or ask user to run `npm run dev` or `composer run dev`This comprehensive guide ensures consistent development practices across the Lara Dashboard CMS project while leveraging modern Laravel features and tooling.