Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
8 / 8 |
| EventServiceProvider | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
8 / 8 |
| boot | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| anonymous function | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| namespace Mtc\Shop\Providers; | |
| use Illuminate\Support\Facades\Event; | |
| use Illuminate\Support\ServiceProvider; | |
| use Mtc\Core\Events\Admin\RegisterCustomGroupModels; | |
| use Mtc\Shop\Events\PriceUpdated; | |
| use Mtc\Shop\Listeners\UpdateSortPrice; | |
| use Mtc\Shop\Product; | |
| use Mtc\Shop\Variant; | |
| class EventServiceProvider extends ServiceProvider | |
| { | |
| /** | |
| * Register any events for your application. | |
| * | |
| * @return void | |
| */ | |
| public function boot() | |
| { | |
| Event::listen(RegisterCustomGroupModels::class, function($event) { | |
| $event->group | |
| ->registerModel(Product::class) | |
| ->registerModel(Variant::class); | |
| }); | |
| Event::listen('core.shop.price_methods', function() { | |
| return [ | |
| 'Mtc\Shop\PriceMethods\PerProduct', | |
| 'Mtc\Shop\PriceMethods\PerVariant', | |
| ]; | |
| }); | |
| Event::listen(PriceUpdated::class, UpdateSortPrice::class); | |
| Event::listen('Mtc\Core\Events\Admin\ItemLoading', 'Mtc\Shop\PriceMethods\Listeners\PerProductForm'); | |
| Event::listen('eloquent.saved: ' . Product::class, 'Mtc\Shop\PriceMethods\Listeners\PerProductSave'); | |
| Event::listen('Mtc\Core\Events\Admin\ItemLoading', 'Mtc\Shop\PriceMethods\Listeners\PerVariantForm'); | |
| Event::listen('eloquent.saved: ' . Variant::class, 'Mtc\Shop\PriceMethods\Listeners\PerVariantSave'); | |
| } | |
| } |