@php $name = $data['componentName']; $attributes = collect($data['attributes'])->filter(fn (mixed $value, string $key) => ! is_array($value)); $personalize = $data['attributes']['personalize'] ?? []; $ignores = ['slot', 'trigger', 'content', 'componentName']; // Although we can use a single filter here, it was // preferable to do it this way to increase readability. $properties = collect($data) ->filter(fn (mixed $value, string $key) => ! is_array($value)) ->filter(fn (mixed $value, string $key) => ! is_callable($value)) ->filter(fn (mixed $value, string $key) => ! in_array($key, $ignores)); @endphp
{{ $name }} @if ($attributes->isNotEmpty()) Attributes @endif @if (!empty($personalize)) Scoped Personalization @endif