Laravel 未定义的属性:Symfony\Component\HttpFoundation\ParameterBag::$dated(使用maatwebsite导出excel)
我犯了错误,我不知道这是什么错误 在我的控制器中Laravel 未定义的属性:Symfony\Component\HttpFoundation\ParameterBag::$dated(使用maatwebsite导出excel),laravel,api,vue.js,maatwebsite-excel,Laravel,Api,Vue.js,Maatwebsite Excel,我犯了错误,我不知道这是什么错误 在我的控制器中 public function exportExcel(Request $data) { return Excel::download(new VgetAttGeneralExport($data), 'rekap-perkelas.xlsx'); } namespace App\Exports; use Illuminate\Contracts\View\View; use Maatwebsite\Exce
public function exportExcel(Request $data)
{
return Excel::download(new VgetAttGeneralExport($data), 'rekap-perkelas.xlsx');
}
namespace App\Exports;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\Exportable;
class VgetAttGeneralExport implements FromView
{
use Exportable;
public $data;
/**
* @return \Illuminate\Support\Collection
*/
public function __construct($data) {
$this->data = $data;
}
public function view(): View
{
$data = $this->data;
return view('exports.Kehadiran',compact('data'));
}
}
这是我的要求
0:{keyid: 6046, att_seq: 6046, att_enumber: "101415287", att_method: null, att_workcode: null,…}
在我的导出文件夹中
public function exportExcel(Request $data)
{
return Excel::download(new VgetAttGeneralExport($data), 'rekap-perkelas.xlsx');
}
namespace App\Exports;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\Exportable;
class VgetAttGeneralExport implements FromView
{
use Exportable;
public $data;
/**
* @return \Illuminate\Support\Collection
*/
public function __construct($data) {
$this->data = $data;
}
public function view(): View
{
$data = $this->data;
return view('exports.Kehadiran',compact('data'));
}
}
这是我的观点
<table>
<tbody>
@foreach($data as $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->dated }}</td>
<td>{{ $item->employee_id }}</td>
<td>{{ $item->employee_name }}</td>
<td>{{ $item->tingkat }}{{$item->div_name}}{{$item->kelas}}</td>
<td>{{ $item->stat_name }}</td>
<td>{{ $item->stat_desc }}</td>
</tr>
@endforeach
</tbody>
</table>
@foreach($数据作为$项)
{{$loop->iteration}
{{$item->dated}
{{$item->employee_id}
{{$item->employee_name}
{{$item->tingkat}{{$item->div_name}{{{$item->kelas}}
{{$item->stat_name}
{{$item->stat_desc}
@endforeach
我已经尝试了很多方法,但我被卡住了,请任何人帮帮我,我是api laravel的初学者我认为
{{{$item->dated}
应该是{{$item->date}
。请检查您的属性名称。检查您的数据库字段名称
,可填充
Collection@DhananjayKyada属性的名称是正确的