If you want an array and still have access to the child elements, you should use the with method.
return $currentUser
->blogs()
->with('articles')
->orderBy('created_at', 'DESC')
->get()
->toArray();
You should use the function name you used to create the relationship in the blog model.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community