I am trying to pass an array to blade view in Laravel. Here is my code in controller:
$event_nav= array();
$event_nav[] = DB::table('tr_visit')
->join ('tm_child','tr_visit.Child_ID','=','tm_child.Child_ID')
->where('tr_visit.Child_ID', 'LIKE', '%' . $childName . '%')
->select(DB::raw('YEAR(Visit_Date)'))
->distinct()
->get();
return view('ProfilAnak.BmiAnak.seeBmi',compact('event_nav'));
and here is my view:
@foreach($event_nav as $year)
{{$event_nav[0]}}
@endforeach
I'm getting following error message :
"htmlentities() expects parameter 1 to be string, array given"
can anyone help?