首先,安裝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管理數據庫文件支持修改需要引入此類