这就是集合
你可以像遍历简单的 PHP 数组一样来遍历它们
$users = App\User::where('active', 1)->get();
foreach ($users as $user) {
echo $user->name;
}
其它常用,以及超级强大的方法
地址:
https://learnku.com/docs/laravel/7.x/eloquent-collections/7501
这就是集合
你可以像遍历简单的 PHP 数组一样来遍历它们
$users = App\User::where('active', 1)->get();
foreach ($users as $user) {
echo $user->name;
}
其它常用,以及超级强大的方法
地址:
https://learnku.com/docs/laravel/7.x/eloquent-collections/7501