With Laravel 7, I began to use View Components.
I am trying to pass the $attributes
variable from one component to another like:
x-modal component:
<div {{ $attributes->merge(['class' => 'modal fade']) }}>
Something great...
</div>
x-modal-form component:
<x-modal {{ $attributes }}>
Something great too
</x-modal>
In this case, I have an id property in the x-modal component like:
<x-modal-form id="aRandomId" title="Test"></x-modal-form>
But in this case, the id aRandomId is not spread to the x-modal component. I have an error "syntax error, unexpected 'endif' (T_ENDIF), expecting end of file" because of {{ $attributes }}
Do you know how to do that?