crate excel for volation mission
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission;
|
||||
|
||||
use App\Exports\V3\Mission\Violation\CountryReport;
|
||||
use App\Exports\V3\Mission\Violation\ProvinceReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\City;
|
||||
@@ -9,6 +11,9 @@ use App\Models\Province;
|
||||
use App\Services\Cartables\Mission\ReportService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use PhpOffice\PhpSpreadsheet\Exception;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class ReportController extends Controller
|
||||
{
|
||||
@@ -29,20 +34,28 @@ class ReportController extends Controller
|
||||
'city' => City::query()->where('province_id', $request->province_id)->get(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
//
|
||||
// public function countryExcelActivity(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
// {
|
||||
// $data = $operatorService->countryActivity($request);
|
||||
// $name = 'گزارش تخلفات ماموریت ها '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
//
|
||||
// return Excel::download(new ExcelReport($data), $name);
|
||||
// }
|
||||
//
|
||||
// public function provinceExcelActivity(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
// {
|
||||
// $data = $operatorService->provinceActivity($request);
|
||||
// $name = 'گزارش تخلفات ماموریت ها '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
//
|
||||
// return Excel::download(new ProvinceExcelReport($data, $request), $name);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function countryExcelActivity(Request $request, ReportService $reportService): BinaryFileResponse
|
||||
{
|
||||
$data = $reportService->countryActivity($request);
|
||||
$name = 'گزارش تخلفات ماموریت ها '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
|
||||
return Excel::download(new CountryReport($data), $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function provinceExcelActivity(Request $request, ReportService $reportService): BinaryFileResponse
|
||||
{
|
||||
$data = $reportService->provinceActivity($request);
|
||||
$name = 'گزارش تخلفات ماموریت ها '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
|
||||
return Excel::download(new ProvinceReport($data), $name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user