سلام
وقت بخیر
تفاوت بین این دو مدل پیاده سازی متد download چیه؟
# First way
public function downloadDemo($product_id)
{
$product = Product::findOrFail($product_id);
return Response()->download(public_path($product->demo_url));
}
public function downloadsource($product_id)
{
$product = Product::findOrFail($product_id);
return response()->download(storage_path('app/local_storage/' . $product->source_url));
}
# Second way
public function downloadDemo($product_id)
{
$product = Product::findOrFail($product_id);
$demoPath = $product->demo_url;
return Response::download($demoPath);
}
public function downloadsource($product_id)
{
$product = Product::findOrFail($product_id);
$sourcePath = $product->source_url;
return Response::download(storage_path('app/local_storage/') . $sourcePath);
}