/**
  * @param array $data
  *
  * @return \Illuminate\Database\Eloquent\Model
  */
 public function create(array $data = [])
 {
     /** @var User $user */
     $user = parent::create($data);
     $user->roles()->attach((array) array_get($data, 'roles', []));
     return $user;
 }
 /**
  * @param array $data
  *
  * @return \Illuminate\Database\Eloquent\Model
  * @throws SectionException
  */
 public function create(array $data = [])
 {
     if (is_null($type = array_get($data, 'type'))) {
         throw new SectionException('Type not set');
     }
     if (is_null($typeObject = DatasourceManager::getTypeObject($type))) {
         throw new SectionException("Datasource type {$type} not found");
     }
     DatasourceManager::createTableSection($section = parent::create($data));
     return $section;
 }
 /**
  * @param array $data
  *
  * @return \Illuminate\Database\Eloquent\Model
  * @throws FieldException
  */
 public function create(array $data = [])
 {
     if (is_null($type = array_get($data, 'type'))) {
         throw new FieldException('Type not set');
     }
     if (is_null($typeObject = FieldManager::getFieldTypeBy('type', $type))) {
         throw new FieldException("Datasource field type {$type} not found");
     }
     /** @var FieldInterface $field */
     $field = parent::create($data);
     FieldManager::addFieldToSectionTable($field->getSection(), $field);
     return $field;
 }
 /**
  * @param array $data
  *
  * @return \Illuminate\Database\Eloquent\Model
  */
 public function create(array $data = [])
 {
     $role = parent::create($data);
     $role->syncPermissions((array) array_get($data, 'permissions'));
     return $role;
 }