I want to fetch data from a view in Oracle, SQL query in controller is as follows :
$cnx = DB::connection('oracle');
$outs = $cnx->select("SELECT client FROM M_CLIENT
WHERE INSTR(STATUS, 'OUT')>0
AND DPTID=:dptid",['dptid'=>$dptId[0]->dptid]);
and the return : return view('clients.home', compact('outs'));
But if I loop though outs in controller
for ($i=0; $i < count($outs); $i++) {
print_r($outs[$i]->client );
echo '<br/>';
}
I get the list of clients as wanted
While in blade, I tried :
@for ($i = 0; $i < 3; $i++)
<tr>
<td> {{ $outs[$i]['client'] }} </td>
</tr>
@endfor
and :
@foreach($outs as $out)
<tr>
<td> {{ $out['client'] }} </td>
</tr>
@endforeach
and :
@foreach($outs as $out)
<tr>
<td> {{ $out->client }} </td>
</tr>
@endforeach
I get a blank page with 500 server error.
PS: The output of dd($outs) is :
array:7 [▼
0 => {#1290 ▼
+"client": "Client1: OUT"
}..