Reputation: 1932
I know this is possible but I've tried to search from the net but I've never found an answer so if anyone who knows how to push data to array from @foreach using Laravel View please help me. Thanks in advance
@foreach ($fields as $key => $rel)
{{ $arrayData = array(
'field_type' =>'$rel->field_type'
)}}
@endforeach
ErrorException in helpers.php line 519: htmlspecialchars() expects parameter 1 to be string, array given (View: C:\xampp\htdocs\fields.blade.php)
Upvotes: 0
Views: 1398
Reputation: 8078
Remove quote from $rel->field_type
@foreach ($fields as $key => $rel)
{{ $arrayData = array(
'field_type' =>$rel->field_type
)}}
@endforeach
Upvotes: 1