Code generation


Overview

Laravel Idea contains a lot of convenient code generations. They are accessible from Code menu:


Or just by key combination (Ctrl-Shift-Comma by default). Generations list with effective search:

Code generations

  • Eloquent Helper Code Generation - details in Eloquent section
  • Create Broadcasting Channel
  • Create Console Command
  • Create Controller
  • Create Database Factory - details in Eloquent section
  • Create Database Migration
  • Create Database Seeder
  • Create Event
  • Create Event Listener
  • Create Exception
  • Create Feature Test
  • Create Form Request
  • Create HTTP Exception
  • Create Job
  • Create Json Resource - details in Eloquent section
  • Create Json Resource Collection
  • Create Mailable
  • Create Middleware
  • Create Model
  • Create Notification
  • Create Observer
  • Create Policy
  • Create Resource Controller
  • Create Service Provider
  • Create Unit Test
  • Create Validation Rule
  • Create View
  • Create View Composer
  • Create Module - code generation for module applications

Configuration

Code generations are highly customizable:


Base namespaces or directories, base classes and templates. Templates can be changed in File | Settings | Editor | File and Code Templates:

Modules

Laravel Idea support modules in the generations. It can be useful for projects built using file structure described here - https://stitcher.io/blog/laravel-beyond-crud-01-domain-oriented-laravel. Needed option can be turned on here - File | Settings | Languages & Frameworks | PHP | Laravel Idea | Module System: