Please format your code by adding ``` on the line before and after the code.
laravel + maatwebsite error
Hello everyone, I am trying to use /maatwebsite library to export excel for the first time, but when I try to export data, the system gives this error:
SQLSTATE[22P02]: Invalid text representation: 7 ERROR: la sintaxis de entrada no es válida para integer: «exportExcel» (SQL: select * from "groups" where "id" = exportExcel limit 1)
Here is my code:
html: a href="{{ route('group.exportExcel') }}"> <i class="fa fa-file-excel-o" </i </a (tags has been removed for post reazons)
web.php: Route::get('/admin/group/exportExcel', 'GroupController@exportExcel')->name('group.exportExcel');
GroupController: public function exportExcel(Request $request){ return Excel::download(new GroupExport(),'group.xls'); }
App/Exports/GroupExport.php:
use App\Group; use Illuminate\Support\Collection; use Maatwebsite\Excel\Concerns\FromCollection;
class GroupExport implements FromCollection { /** * @return Collection */ public function collection() { return Group::all(); } }
Can anyone help me please?
Please or to participate in this conversation.