/** * @param $id * @param bool $withUsers * @return mixed * @throws GeneralException */ public function findOrThrowException($id, $withUsers = false) { if ($withUsers) { $auth_id = access()->user()->id; $media = Media::where('owner_id', $auth_id)->withTrashed()->find($id); } else { $media = Media::withTrashed()->find($id); } if (!is_null($media)) { return $media; } throw new GeneralException('That media does not exist.'); }