exportSpecific
This commit is contained in:
@@ -8,8 +8,7 @@ use App\Models\ManageState;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Exports\ReportExport;
|
||||
|
||||
|
||||
use App\Models\ManageRestaurant;
|
||||
|
||||
class ManageReportsController extends Controller
|
||||
{
|
||||
@@ -18,7 +17,8 @@ class ManageReportsController extends Controller
|
||||
{
|
||||
try {
|
||||
$states = ManageState::all();
|
||||
return view('Admin.pages.manage_reports.manage_reports', compact('states'));
|
||||
$restaurants = ManageRestaurant::all();
|
||||
return view('Admin.pages.manage_reports.manage_reports', compact('states','restaurants'));
|
||||
} catch (\Exception $e) {
|
||||
Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage(), ['exception' => $e]);
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
@@ -40,10 +40,12 @@ public function exportReports(Request $request)
|
||||
{
|
||||
$reportType = $request->input('reportType');
|
||||
$states = $request->input('states');
|
||||
$restaurants = $request->input('restaurants', []);
|
||||
|
||||
$startDate = $request->input('startDate');
|
||||
$endDate = $request->input('endDate');
|
||||
|
||||
return Excel::download(new ReportExport($reportType, $states, $startDate, $endDate), 'report.xlsx');
|
||||
return Excel::download(new ReportExport($reportType, $states, $startDate, $endDate, $restaurants), 'report.xlsx');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user