Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Aggregators\Object;
- use App\Service\ObjectService;
- use App;
- class RestourantAggregator
- {
- public function getSertvice():ObjectService
- {
- return App::make(ObjectService::class);
- }
- }
- <?php
- namespace App\Aggregators\Object;
- use App\Service\ObjectService;
- use App;
- class BeautyAggregator
- {
- public function getSertvice():ObjectService
- {
- return App::make(ObjectService::class);;
- }
- }
- и использую contextual binding
- $this->app->when(BeautyAggregator::class)
- ->needs(ObjectService::class)
- ->give(function ($app) {
- return new BeautyImpl($app->make(TimetableService::class), $app->make(ObjectRepository::class));
- });
- $this->app->when(RestourantAggregator::class)
- ->needs(ObjectService::class)
- ->give(function ($app) {
- return new RestaurantImpl($app->make(TimetableService::class), $app->make(ObjectRepository::class));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement