How to order my foreach in laravel blade

Solution:

Guessing, because you haven’t told us what error you’re getting, but:

$clients->notes is an already-fetched collection of results. $clients->notes() is a query builder that you can apply further logic like ordering or additional criteria to.

You likely want:

$clients->notes()->orderBy('created_at', 'desc')->get()

but you should do that in the controller and pass it to the view instead of having the query directly in the Blade template.

(You can alternatively use Laravel’s collection functions on $clients->notes, including the sortBy() function).