Fenos\Notifynder\Contracts\NotifynderCategory::findByName PHP Method

findByName() public method

Find a category by name.
public findByName ( $name ) : mixed
$name
return mixed
    public function findByName($name);

Usage Example

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;
 }
All Usage Examples Of Fenos\Notifynder\Contracts\NotifynderCategory::findByName