首先,安装phpstorm插件laravel
然后安装composer支持并自动完成提示生成
如果只想在开发环境安装请加上 --dev
composer require barryvdh/laravel-ide-helper
php artisan ide-helper:eloquent
php artisan ide-helper:generate //为 Facades 生成注释
php artisan ide-helper:meta //生成 PhpStorm Meta file
php artisan ide-helper:models //为数据模型生成注释
为所有模型生成注释 php artisan ide-helper:models, 这时会出现询问:
Do you want to overwrite the existing model files? Choose no to write to _ide_helper_models.php instead? (Yes/No): (yes/no) [no]:
输入 yes 则会直接在模型文件中写入注释,否则会生成「_ide_helper_models.php」文件。建议选择 yes,这样在跟踪文件的时候不会跳转到「_ide_helper_models.php」文件,不过这么做最好对模型文件做个备份,至少在生成注释之前用 git 控制一下版本,以防万一。 为防止model被覆盖,则选择默认的 no
composer require doctrine/dbal //migration管理数据库文件支持修改需要引入此类