I am trying to delete a file after I delete the product from the database, but it shows me an error, and I cannot find a solution.
Call to a member function delete() on null
public function supprod($id,Request $request)
{
$produits=Produit::find($id);
$produits->delete(); // <-- error on this line
$filename=(string)$document->nom;
Storage::disk('fichier')->delete($filename);
return redirect()->back();
}