I want to pass an array from view to partial. Currently it's possible to do it for a single variable this way:
@include('partials.datatable' , ['var' => 'value'])
But I want var
to be an array like this:
@include('partials.datatable' , ['var' => ['value1', 'value2']])
So I should use it in partial as:
{{ $var[0] }}
Is it possible to do such thing?
This is exactly how it works. I was looking for some examples, landed here. e.g Parent:
@include('layouts.companies', ['popular_agencies' => $popular_agencies])
Child:
@foreach ($popular_agencies as $popular)
//Do something here..
@endforeach