Eloquent


Eloquent Helper Code Generation

New Eloquent helper code generation allows to have completion for fields, relations, scopes and collection proxies. It uses migrations or database connection to get information about database tables and fields.


However, barryvdh/laravel-ide-helper package still can be used to generate the needed phpDocs(ide-helper:models artisan command):


phpDocs in the special file _ide_helper_models.php are also allowed.

Completions

Laravel Idea completes fields and relations almost everywhere in the strings:


Even in complex cases, it understands that here it should complete Post class fields:


Relations chain is also not a problem:


Fields inside class:

JSON resource generation

JSON resource generation is accessible from the main Code generation menu or in the Generate menu in the Eloquent class (Alt-Ins or Command(Ctrl)-N). It uses fields and relations information to generate full JSON resource for this class:


Database factory generation

Database factory generation is accessible from the main Code generation menu or in the Generate menu in the Eloquent class (Alt-Insert or Command(Ctrl)-N). It uses fields and relations information to generate full database factory for this class:

Database factory type hinting

Laravel Idea hints the type of factory()->create() calls:


Multiple create also supported: