52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\ProvinceDashboard\OperatorDialogues;
|
|
|
|
use App\Exports\OperatorDialogues\OperatorCartableExcel;
|
|
use App\Http\Controllers\Controller;
|
|
use app\Http\Traits\ApiResponse;
|
|
use App\Models\OperatorDialogue;
|
|
use App\Services\Dashboard\Province\OperatorDialogues\DataTableService;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
|
|
|
class OperatorController extends Controller
|
|
{
|
|
use ApiResponse;
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index(Request $request, DataTableService $dataTableService): JsonResponse
|
|
{
|
|
return response()->json($dataTableService->index($request));
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(OperatorDialogue $operatorDialogue): JsonResponse
|
|
{
|
|
return $this->successResponse($operatorDialogue);
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function download(Request $request, string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function excel(Request $request, DataTableService $dataTableService): BinaryFileResponse
|
|
{
|
|
$name = 'گزارش از کارتابل پیام های سیستمی ' . now()->format('Y-m-d H:i') . '.xlsx';
|
|
$data = $dataTableService->dataTable($request, true);
|
|
return Excel::download(new OperatorCartableExcel($data['data']), $name);
|
|
}
|
|
}
|