App\Repositories\RepositoryInterface::create PHP Method

create() public method

Create a new model.
public create ( array $data ) : mixed
$data array Data to create a model
return mixed
    public function create(array $data);

Usage Example

Esempio n. 1
0
 /**
  * @param array $attributes
  * @return mixed
  * @throws ValidationException
  */
 public function create(array $attributes)
 {
     $rules = array_merge($this->rules['common'], $this->rules['create']);
     $validator = $this->validation->make($attributes, $rules);
     if ($validator->fails()) {
         throw new ValidationException($validator);
     }
     return $this->model->create($attributes);
 }