Fenos\Notifynder\Builder\NotifynderBuilder::category PHP Method

category() public method

Set Category and covert it, to the id if name of it given.
public category ( $category )
$category
    public function category($category)
    {
        if (!is_numeric($category)) {
            $category = $this->notifynderCategory->findByName($category)->id;
        }
        $this->setBuilderData('category_id', $category);
        return $this;
    }

Usage Example

Example #1
0
 /** @test */
 function it_send_with_an_custom_sender()
 {
     $this->senders->extend('sendCustom', function ($notification, $app) {
         return new CustomDefaultSender($notification, $app->make('notifynder'));
     });
     $category_name = 'my.category';
     $this->createCategory(['name' => $category_name]);
     $singleNotification = $this->builder->category($category_name)->to(1)->from(2)->url('www.notifynder.io')->toArray();
     $this->senders->sendCustom($singleNotification);
     $this->assertCount(1, Notification::all());
 }
All Usage Examples Of Fenos\Notifynder\Builder\NotifynderBuilder::category