The CategoryManager is responsible to deal with the notification categories
Ejemplo n.º 1
0
 /**
  * Send group notifications.
  *
  * @param  StoreNotification $sender
  * @return mixed
  */
 public function send(StoreNotification $sender)
 {
     // Get group
     $group = $this->notifynderGroup->findByName($this->nameGroup);
     // Categories
     $categoriesAssociated = $group->categories;
     // Send a notification for each category
     foreach ($categoriesAssociated as $category) {
         // Category name
         $categoryModel = $this->notifynderCategory->findByName($category->name);
         $notification = array_merge(['category_id' => $categoryModel->id], $this->info);
         $sender->storeSingle($notification);
     }
     return $group;
 }
Ejemplo n.º 2
0
 /**
  * Set Category and covert it, to the id
  * if name of it given
  *
  * @param $category
  * @return $this
  */
 public function category($category)
 {
     if (!is_numeric($category)) {
         $category = $this->notifynderCategory->findByName($category)->id;
     }
     $this->setBuilderData('category_id', $category);
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * Update a category
  *
  * @param  array $updates
  * @param        $id
  * @return mixed
  */
 public function updateCategory(array $updates, $id)
 {
     return $this->notifynderCategory->update($updates, $id);
 }