%PDF- %PDF-
Direktori : /home/silvzytp/crm-ind-code/app/Http/Controllers/Backend/ |
Current File : //home/silvzytp/crm-ind-code/app/Http/Controllers/Backend/ExportController.php |
<?php namespace App\Http\Controllers\Backend; use App\Models\Colling; use Illuminate\Http\Request; use App\Exports\CallingExport; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Auth; use Maatwebsite\Excel\Facades\Excel; use App\Exports\ManagerCallingExport; class ExportController extends Controller { public function export(Request $request){ $data = Colling::all(); if (!$data->isEmpty()) { return Excel::download(new CallingExport($request), 'calling_data.'.$request->export_file); }else{ return back()->with('error','Calling data is empty!'); } } public function managerExport(Request $request){ $data = Colling::whereIn('agent_id',Auth::user()->agents->pluck('id'))->get(); if (!$data->isEmpty()) { return Excel::download(new ManagerCallingExport($request), 'calling_data.'.$request->export_file); }else{ return back()->with('error','Calling data is empty!'); } } }