get('fileName')) { $fileNameWithPath = \Storage::disk()->path('Export'.DIRECTORY_SEPARATOR.\request()->get('fileName')); return response()->file($fileNameWithPath, ['Content-Disposition' => 'attachment;filename='.\request()->get('fileName')]); } $Suppliers = \App\Models\Supplier::with(['profitCenter' => function ($query) { $query->orderBy('name'); }])->orderBy('name')->get(); $fileName = 'SuppliersProfitCenters_'.date('Ymd_His').'.xlsx'; Excel::store(new ExportSuppliersProfitCentersExcel(['Suppliers' => $Suppliers]), 'Export/'.$fileName); return view('admin.export.SupplierProfitCenterExcelSuccess', ['fileName' => $fileName]); return response()->json(['success' => true]); return Excel::download(new ExportSuppliersProfitCentersExcel(['Suppliers' => $Suppliers]), 'SuppliersProfitCenters'.date('Ymd_His').'.xlsx'); return view('admin.export.SupplierProfitCenterExcel')->with(['Suppliers' => $Suppliers]); } /** * Show the form for editing the specified resource. * * @return \Illuminate\Http\Response */ public function edit(int $id) { // } /** * Update the specified resource in storage. * * @return \Illuminate\Http\Response */ public function update(Request $request, int $id) { // } /** * Remove the specified resource from storage. * * @return \Illuminate\Http\Response */ public function destroy(int $id) { // } }