'How to make repository in laravel

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



Solution 1:[1]

To use php artisan make:repository UserRepository,

install this library https://github.com/jason-guru/laravel-make-repository,

by using the composer command composer require jason-guru/laravel-make-repository --dev

Hope this helps.

Solution 2:[2]

The repository pattern is not connected to the Laravel framework but it sure made it a lot more popular!

You can install a package made for Laravel 5 to enable it!!

https://laracasts.com/discuss/channels/tips/repoist-laravel-5-repository-generator?page=1

Solution 3:[3]

Using this package you can create create Repository, Repository with Interface, Service, Trait form command line using php artisan command.

composer require theanik/laravel-more-command --dev

for create e repository class

php artisan make:repository UserRepository

it also auto resolve namespace.

Git repo : https://github.com/theanik/laravel-more-command

Solution 4:[4]

Have you checked if the `php artisan make:repo` command is supported for your project?

If you didn't, open a terminal in the root of your project and type the php artisan command. Check near the make section.

If you see a make:repository command, then you can use above command.

If not, then refer to this link After installing you can use the php artisan make:repository command. I hope it helps,

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 G Jason Sharma
Solution 2 Sapnesh Naik
Solution 3
Solution 4 jojomanoke