order; Gate::authorize('view', $order); // Si le fichier n'existe pas dans le stockage public if (!Storage::disk('public')->exists($attachment->file_path)) { abort(404, 'Fichier non trouvé.'); } $path = Storage::disk('public')->path($attachment->file_path); // On renvoie le fichier pour affichage inline (utile pour les PDF/images) return response()->file($path, [ 'Content-Disposition' => 'inline; filename="' . basename($attachment->file_name) . '"' ]); } }