Most Used Materials
@php
$mostUsed = collect($usageStats)
->sortDesc()
->take(5)
->keys()
->map(function($id) use ($materials) {
foreach ($materials as $type => $items) {
foreach ($items as $item) {
if ($item->id == $id) {
return $item;
}
}
}
return null;
})
->filter();
@endphp
@if($mostUsed->isEmpty())
You haven't used any marketing materials yet.
@else
@foreach($mostUsed as $material)
{{ $material->title }}
{{ ucfirst($material->type) }}
{{ Str::limit($material->description, 80) }}
{{ $usageStats[$material->id] ?? 0 }} uses
@endforeach
@endif