public function showPicture($id) { $segments = explode('/', $id); $todos = ArticleModel::find($segments); if (count($todos) > 0) { $path = $todos->pluck('article_filepath'); $filename = $todos->pluck('article_filename'); ob_end_clean(); return response()->download(public_path() . $path[0], $filename[0], ['Content-Type' => 'image/png']); } else { return ['message' => 'NOT FOUND', 'state' => 'article picture']; } }