在 laravel 的自定义路径中创建模型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37251322/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Create model in a custom path in laravel
提问by Saleh Ahmad Oyon
I want to create a model in a custom path. If i write the php artisan command like the following it will create model inside app.
我想在自定义路径中创建一个模型。如果我编写如下所示的 php artisan 命令,它将在应用程序中创建模型。
php artisan make:model core
But i want to create the model file inside the custom made Models folder. How can i do it ?
但我想在定制的 Models 文件夹中创建模型文件。我该怎么做 ?
回答by sz ashik
Just define the path where you want to create model.
只需定义要创建模型的路径。
php artisan make:model <directory_name>/<model_name>
e.g.
例如
php artisan make:model Models/core
回答by Chonchol Mahmud
You can do it easily with custom directory of your Models Folder (I assume Models Folder is sub folder of App).
Just use this command php artisan make:model Models/core
then you will get your desire result.
Thanks.
您可以使用模型文件夹的自定义目录轻松完成(我假设模型文件夹是 App 的子文件夹)。只要使用这个命令,php artisan make:model Models/core
你就会得到你想要的结果。
谢谢。