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