I want to get data "report_to" from database. But i got error when I try to print variable in my view page. It's said "ErrorException htmlspecialchars() expects parameter 1 to be string, array given".
This is my controller.
function editroledetails(Request $request)
{
$user = \Auth::user();
$userphone = 0;
$reportTo = DB::select(DB::raw("SELECT report_to FROM customer_type WHERE username='19331986' "));
$data = [
'editUsername' => $request->editUsername,
'editNik' => $request->editNik,
'editEmail' => $request->editEmail,
'editRegIdentities' => $request->editRegIdentities,
'editID' => $request->editID
];
return view('editroledetails', compact('user', 'userphone', 'data', 'reportTo'));
}
This is my view
<div class="alert alert-info">
<h3>{{$reportTo}}</h3>
</div>
I expect the view will display the variable that is "Name", but I got error htmlspecialchars() expects parameter 1 to be string, array given.