luqserious/laravel-6-rules icon
public
Published on 7/29/2025
Laravel 6 Rules

Rules

AI Assistant Rules for Laravel 6 Projects

This document defines the conventions and rules the AI Assistant must follow when assisting with Laravel 6 projects. Laravel 6 is a Long Term Support (LTS) release, so stability, compatibility, and adherence to framework conventions are essential.


Core Rules for Laravel 6

1. Framework Compatibility

  • All code must be compatible with Laravel 6.x.
  • Do not suggest features introduced in Laravel 7+.

2. Routing

  • Use Route::get('uri', 'Controller@method') syntax.
  • Avoid ::class based controller routes.
  • Use routes properly.

Example:

Route::get('/users', 'UserController@index');

3. Authentication

Use laravel/ui for auth scaffolding.

composer require laravel/ui "^1.0"
php artisan ui vue --auth

4. Eloquent ORM

  • Use Laravel 6-supported relationships and query scopes.
  • Avoid model casting or relationship features added after Laravel 6.

5. Helper Functions

  • Use global helpers (array_get, str_slug, bcrypt, etc.)
  • Ensure helper functions are not deprecated in Laravel 6.

6. Testing

  • Use PHPUnit (no Pest).
  • Test class naming should follow: Feature and Unit.

Folder Structure Conventions

app/
  Console/
  Exceptions/
  Http/
    Controllers/
      Auth/
    Middleware/
    Requests/
  Models/            <- Use this if you separate models (optional)
  Providers/
config/
database/
  factories/
  migrations/
  seeds/
resources/
  js/
  lang/
  sass/
  views/
routes/
  api.php
  console.php
  web.php
tests/
  Feature/
  Unit/

Note: Laravel 6 stores models in app/ by default. You can create an app/Models/ folder if preferred.


Naming Conventions

  • Controllers: PascalCase + ControllerUserController.php
  • Models: Singular PascalCaseUser.php
  • Migrations: snake_case + timestamp prefix2025_07_29_000000_create_users_table.php
  • Views: snake_case folders and filesresources/views/user/profile.blade.php
  • Routes: kebab-case URIs/user-profile
  • Variables/Methods: camelCase$userList, getUserData()
  • Requests: PascalCase + RequestStorePostRequest.php
  • Seeders: PascalCase + SeederUsersTableSeeder.php

AI Assistant Behavior

  • Always explain Laravel 6-specific solutions clearly.
  • Suggest code using Laravel 6 syntax and features only.
  • Never suggest modern packages, features, or methods that are unsupported.
  • Never reference Livewire, Jetstream, Inertia, Breeze, or Tailwind CSS unless explicitly installed.