I've added that to my Controller but I get:
Call to a member function sortBy() on array
am I putting it in the right place?
My original Controller was:
$profile = Type::orderBy('type')->where('client_id', $client->id)->get();
$profile = $profile->groupBy(function ($type) {
return $type->type;
})->all();
return view('clients.show', compact('client', 'profile'));
and my View:
@foreach($profile as $type => $types)
{{ $type }}
<ul>
@foreach ($types as $type)
<li><a href="/clients/{{ $client->id }}/types/{{ $type->id }}">{{ $type->name }}</a></li>
@endforeach
</ul>
@endforeach