Quickly generate command make for Service and Repository files for projects using Laravel packages.
Via Composer
composer require felipedamacenoteodoro/makeservicerepository --dev
Open the console and enter one of the commands:
- Generate all files for one new Service and Repository interface:
php artisan make:crudsrv {Entity_name}
- Generate a Repository Interface
php artisan make:repositoryi {Entity_name}
- Generate a Service Interface
php artisan make:servicei {Entity_name}
- Generate a Service
php artisan make:service {Entity_name}
- Generate a Repository file
php artisan make:repository {Entity_name}
You need to map the interface bind on your application server provider.
- Exemple:
Add In the boot method of your service provider app/Providers/AppServiceProvider.php
:
$this->app->bind(YourEntityCreatedServiceInterface::class, YourEntityCreatedService::class);
$this->app->bind(YourEntityCreatedRepositoryInterface::class, YourEntityCreatedRepository::class);
Please see CHANGELOG for more information what has changed recently.