laravel集合的遍历和一些常用功能总结

这就是集合
在这里插入图片描述
你可以像遍历简单的 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

在这里插入图片描述