示例#1
0
 /**
  * Finds an object by Id.
  *
  * @param int  $id
  * @param bool $softDeleted
  *
  * @return \Illuminate\Support\Collection|null|void|static
  */
 public function findById($id, $softDeleted = true)
 {
     if ($softDeleted && method_exists($this->model, 'withTrashed')) {
         return $this->model->withTrashed()->find($id);
     }
     return $this->model->find($id);
 }