В основном я получил запрос, и результаты будут созданы в виде файла Excel. Вот мой код
$data = \DB::table('checkers')
->where('remarks_id',2)
->join('schedules','schedules.id','=','checkers.schedule_id')
->join('teachers','schedules.teacher_id','=','teachers.id')
->join('subject_codes','subject_codes.id','=','schedules.subject_code_id')
->join('remarks','remarks.id','=','checkers.remarks_id')
->where('checkers.created_at', '=>', $request->from)
->where('checkers.created_at', '=<', $request->to)
->select('teachers.fullname','subject_codes.subject_description','remarks.remarks_desc','checkers.created_at')
->get();
$data = $data->map(function ($x) {
return json_decode(json_encode($x), true);
})->all();
// dd($data);
Excel::create('report', function($excel) use($data) {
$excel->sheet('Sheetname', function($sheet) use($data) {
});
})->export('xls');
, когда я делаю `dd ($ data)
array:2 [
0 => {#294
+"fullname": "Edcel Pagagao"
+"subject_description": "Capstone 1"
+"remarks_desc": "No Teacher Around"
+"created_at": "2020-01-30 00:00:00"
}
1 => {#298
+"fullname": "Edcel Pagagao"
+"subject_description": "Capstone 1"
+"remarks_desc": "No Teacher Around"
+"created_at": "2020-01-27 00:00:00"
}
]
Это то, что сказали в документах https://docs.laravel-excel.com/2.1/export/array.html на основе 2. x версия
Но я все еще получил ошибку continue" targeting switch is equivalent to "break". Did you mean to use "continue 2