Domain\Repositories\Traits\StoreTrait::store PHP Method

store() public method

Store new item of model.
public store ( array $data ) : Model
$data array
return Model
    public function store(array $data)
    {
        if (empty($data)) {
            throw new RepositoryException('Empty data');
        }
        $model = $this->model;
        try {
            $model->fill($data);
        } catch (Exception $e) {
            Log::error($e->getMessage());
            throw new RepositoryException('Empty fillable');
        }
        try {
            $model->save();
            return $model;
        } catch (Exception $e) {
            Log::error($e->getMessage());
            throw new RepositoryException('Error store');
        }
    }
StoreTrait