gpt4 book ai didi

php - 未定义的属性:Illuminate\Pagination\LengthAwarePaginator::$name

转载 作者:行者123 更新时间:2023-12-03 11:22:44 25 4
gpt4 key购买 nike

我正在尝试从我的表中获取数据并将其显示在我的 View 中并对这些数据进行分页。我收到了这个问题,但找不到任何解决方案。我在之前的项目中做了完全相同的事情,而且效果很好。

这是我的 Controller

public function hadiBirlikteCalisalimShow (){
$users =DB::table('birlikte_calisalim')->paginate(15);
return view('admin.birliktecalisalim',compact(['users']));
}

这是我的观点
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>İsim</th>
<th>Email</th>
<th>Tarih</th>
<th>İstek</th>
</tr>
</thead>

<tbody>
@foreach($users as $row)
<tr>
<td>{{$users->name}}</td>
<td>{{$users->email}}</td>
<td>{{$users->tarih}}</td>
<td>{{$users->message}}</td>
</tr>
@endforeach
</tbody>
</table>
{{$users->links()}}

最佳答案

@foreach($users as $row)
<tr>
<td>{{$row->name}}</td>
<td>{{$row->email}}</td>
<td>{{$row->tarih}}</td>
<td>{{$row->message}}</td>
</tr>
@endforeach

应该是 $row->name,$row->email等...不是 $users->name ,并更改 {{$users->links()}}{!! $users->render() !!}

关于php - 未定义的属性:Illuminate\Pagination\LengthAwarePaginator::$name,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38475845/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com