Stevemo\Cpanel\Group\Repo\CpanelGroupInterface::create PHP Метод

create() публичный Метод

Creates a group.
Автор: Steve Montambeault
public create ( array $attributes ) : Cartalyst\Sentry\Groups\GroupInterface
$attributes array
Результат Cartalyst\Sentry\Groups\GroupInterface
    public function create(array $attributes);

Usage Example

Пример #1
0
 /**
  * Create a new Group
  *
  * @author Steve Montambeault
  * @link   http://stevemo.ca
  *
  * @param array $data
  *
  * @return bool
  */
 public function create(array $data)
 {
     try {
         if ($this->validator->with($data)->passes()) {
             $this->groups->create($data);
             return true;
         }
     } catch (GroupExistsException $e) {
         $this->validator->add('GroupExistsException', $e->getMessage());
     } catch (NameRequiredException $e) {
         $this->validator->add('NameRequiredException', $e->getMessage());
     }
     return false;
 }