Fenos\Notifynder\Categories\CategoryRepository::add PHP Méthode

add() public méthode

Add a category to the DB.
public add ( array $name, $text ) : static
$name array
$text
Résultat static
    public function add($name, $text)
    {
        return $this->categoryModel->create(compact('name', 'text'));
    }

Usage Example

 /** @test */
 function it_add_a_new_category()
 {
     $categoryData = Factory::build('Fenos\\Notifynder\\Models\\NotificationCategory');
     $createCategory = $this->categoryRepo->add($categoryData->name, $categoryData->text);
     $this->assertEquals($categoryData->name, $createCategory->name);
 }