Example #1
0
 /**
  * Find data by id or return new if not exists.
  *
  * @param $id
  * @param array $columns
  *
  * @return mixed
  */
 public function findOrNew($id, $columns = ['*'])
 {
     $this->applyCriteria();
     $this->applyScope();
     $model = $this->model->findOrNew($id, $columns);
     $this->resetModel();
     return $this->parserResult($model);
 }
Example #2
0
 /**
  * Find data by id and return new instance if not found.
  *
  * @param $id
  * @param array $columns
  *
  * @return mixed
  */
 public function findOrNew($id, $columns = ['*'])
 {
     $model = $this->model->findOrNew($id, $columns);
     $this->resetModel();
     return $model;
 }