dimanche 4 octobre 2020

I want to download a excel file through Checkbox Unique ID in laravel, I am using Maatwebsite\Excel Here

My Controller File

public function enquiryExport($id, Request $request)
{
    $id[] = $request->explode(",",$id);
    return Excel::download(new EnquiryExport($id), 'enquiry.xlsx');
}

and My Export File

 protected $id;
function __construct($id) {
        $this->id = $id;
 }

public function collection()
{
    return Enquiry::whereIn('id',explode(",",$this->id))->get();

   /* return Enquiry::all(); */
}

Route is like

 Route::get('enquiryExport', 'enquiryController@enquiryExport');

Still I am getting this error

"message": "Too few arguments to function App\\Http\\Controllers\\enquiryController::enquiryExport(), 1 passed and exactly 2 expected",

I am checkbox id through AJAX here.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire