每次使用Jeffrey Way的Generators库生成模型时,都会在" app /"中创建模型。目录。例如,我运行以下内容:
php artisan generate:model vision
这是在" app /"中创建的。 。目录
我想让模型在"模型中创建"目录,所以我尝试了这个:
php artisan generate:model --path="models" vision
但是,我收到以下错误:
file_put_contents(models/Vision.php): failed to open stream: No such file or directory
generate:model [--path="..."] [--templatePath="..."] modelName
答案 0 :(得分:0)
在此版本的库中,使用它之前似乎必须存在指定的路径。我能够复制您的体验,如下所示:
[chris@little-mac:four-dot-two]$ php artisan generate:model vision
Created: /Users/chris/Projects/four-dot-two/app/models/Vision.php
[chris@little-mac:four-dot-two]$ php artisan generate:model --path="models" vision
[ErrorException]
file_put_contents(models/Vision.php): failed to open stream: No such file o
r directory
generate:model [--path="..."] [--templatePath="..."] modelName
要解决它,我只是在框架根目录下创建了一个“models”目录。
[chris@little-mac:four-dot-two]$ mkdir models
[chris@little-mac:four-dot-two]$ php artisan generate:model --path="models" vision
Created: models/Vision.php
[chris@little-mac:four-dot-two]$