/** * @param GammaRepositoryInterface $gamma * @param GammaNotification $notification * @param Pusher $pusher */ public function handle(GammaRepositoryInterface $gamma, GammaNotification $notification, Pusher $pusher) { $brands = $gamma->brandsForCategory($this->category); foreach ($brands as $brand) { $canceled = $this->cancelInverseNotifications($notification, $brand, $this->category, $pusher); if ($canceled === 0) { $instance = $notification->newInstance(['account_id' => $this->account->id, 'category_id' => $this->category->id, 'brand_id' => $brand->id, 'type' => CategorySelection::ACTIVATE]); $instance->save(); } } }
/** * @param GammaRepositoryInterface $gamma * @param GammaNotification $notification * @param Pusher $pusher */ public function handle(GammaRepositoryInterface $gamma, GammaNotification $notification, Pusher $pusher) { $categories = $gamma->categoriesForBrand($this->brand); foreach ($categories as $category) { $canceled = $this->cancelInverseNotifications($notification, $this->account, $this->brand, $category, $pusher); if ($canceled === 0) { $instance = $notification->newInstance(['account_id' => $this->account->id, 'category_id' => $category->id, 'brand_id' => $this->brand->id, 'type' => 'activate']); $instance->save(); } } }