laravel blade components pass array code example
Example: laravel components pass array
As far as I know, it isn't possible to pass an array to a component via @slot.
However, it is possible to pass and an array to a component directly, without
using a slot.
@component('mylayouts.partials.contentheader', ['my_array' => ['a', 'b', 'c']])
...
@endcomponent
Then, within your component file, you will have access to a $my_array variable.
For example, in your contentheader.blade.php file you can do this:
<ul>
@foreach($my_array as $value)
<li>{{ $value }}</li>
@endforeach
</ul>