¨4.0.1¨
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Modules\Account\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Order\Entities\Order;
|
||||
|
||||
class AccountDownloadsController
|
||||
@@ -9,7 +10,7 @@ class AccountDownloadsController
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
@@ -18,23 +19,26 @@ class AccountDownloadsController
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$file = $this->getDownloads()->firstWhere('id', decrypt($id));
|
||||
|
||||
if (is_null($file) || ! file_exists($file->realPath())) {
|
||||
if (is_null($file) || !file_exists($file->realPath())) {
|
||||
return back()->with('error', trans('storefront::account.downloads.no_file_found'));
|
||||
}
|
||||
|
||||
return response()->download($file->realPath(), $file->filename);
|
||||
}
|
||||
|
||||
|
||||
private function getDownloads()
|
||||
{
|
||||
return auth()->user()
|
||||
|
||||
Reference in New Issue
Block a user