Laravel pętla przez kolekcję
$users = App\User::where('active', 1)->get();
foreach ($users as $user) {
echo $user->name;
}
Bad Boar
$users = App\User::where('active', 1)->get();
foreach ($users as $user) {
echo $user->name;
}
$collection = $collection->each(function ($item, $key) {
//
});
$post = Post::with('comments.replyComments')->find($id);
$comments = $post->comments;
$replies = $comments->replyComments;