如何在 Laravel 中创建存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47748160/
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
How to make repository in laravel
提问by Kuldeep Mishra
I am new to laravel repository. I want to make a repository in laravel. I tried this command php artisan make:repository UserRepository
but command shows make:repository not found. Please help
我是 laravel 存储库的新手。我想在 Laravel 中创建一个存储库。我试过这个命令,php artisan make:repository UserRepository
但命令显示 make:repository not found。请帮忙
回答by G Jason Sharma
To use php artisan make:repository UserRepository
,
要使用php artisan make:repository UserRepository
,
install this library https://github.com/jason-guru/laravel-make-repository,
安装这个库https://github.com/jason-guru/laravel-make-repository,
by using the composer command composer require jason-guru/laravel-make-repository --dev
通过使用 composer 命令 composer require jason-guru/laravel-make-repository --dev
Hope this helps.
希望这可以帮助。
回答by Sapnesh Naik
The repository pattern is not connected to the Laravel framework but it sure made it a lot more popular!
存储库模式没有连接到 Laravel 框架,但它确实让它更受欢迎!
You can install a package made for Laravel 5 to enable it!!
你可以安装一个为 Laravel 5 制作的包来启用它!!
https://laracasts.com/discuss/channels/tips/repoist-laravel-5-repository-generator?page=1
https://laracasts.com/discuss/channels/tips/repoist-laravel-5-repository-generator?page=1
回答by Rits
Have you checked if the `php artisan make:repo` command is supported for your project?
您是否检查过您的项目是否支持 `php artisan make:repo` 命令?
If you didn't, open a terminal in the root of your project and type the php artisan
command. Check near the make
section.
如果没有,请在项目的根目录中打开一个终端并键入php artisan
命令。检查附近的make
部分。
If you see a make:repository
command, then you can use above command.
如果你看到一个make:repository
命令,那么你可以使用上面的命令。
php artisan make:repository
php artisan make:repository
命令了。我希望它有帮助,