file($this->imagePath($file)); } catch (\Exception $e) { abort(404); } } public function subDirectory(Request $request, string $directory, string $file) { try { return response()->file($this->imagePath("{$directory}/{$file}")); } catch (\Exception $e) { abort(404); } } private function imagePath(string $file): string { return resource_path('images/'.$file); } }