New Eloquent helper code generation allows to have completion for fields, relations, scopes and collection proxies. It uses migrations to get information about database tables and fields. Fetching from database connection will be implemented in one of the next versions. Don't forget to add
_ide_helper_models.php file to .gitignore!
However, barryvdh/laravel-ide-helper package still can be used to generate the needed phpDocs(
ide-helper:models artisan command):
phpDocs in special file
_ide_helper_models.php are also allowed.
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 is accessible from main Code generation menu or in the Generate menu in the Eloquent class (Alt-Ins or or Command(Ctrl)-N). It uses fields and relations information to generate full JSON resource for this class:
Database factory generation is accessible from 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:
Laravel Idea hints the type of
Multiple create is also supported: