change structure of road patrol
This commit is contained in:
@@ -2,12 +2,15 @@
|
||||
|
||||
namespace App\Http\Controllers\V3\RoadPatrole;
|
||||
|
||||
use App\Exports\V3\RoadPatrols\CountryActivity;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Province;
|
||||
use App\Services\Cartables\RoadPatrolTableService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class SupervisorController extends Controller
|
||||
{
|
||||
@@ -23,6 +26,19 @@ class SupervisorController extends Controller
|
||||
'provinces' => $provinces
|
||||
]);
|
||||
}
|
||||
public function countryActivityExcel(Request $request, RoadPatrolTableService $roadPatrolTableService): BinaryFileResponse
|
||||
{
|
||||
$activities = $roadPatrolTableService->countryActivity($request);
|
||||
$provinces = Province::all(['id', 'name_fa']);
|
||||
|
||||
$name = 'گزارش از گشت راهداری و ترابری ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
|
||||
return Excel::download(new CountryActivity([
|
||||
'activities' => $activities,
|
||||
'provinces' => $provinces,
|
||||
]), $name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user