Laravel - Unable to fetch data in blade from Oracle

Viewed 144

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"
  }..
1 Answers

Problem fixed

Forgot about /storage/logs/laravel.log where log errors are written.. Turned out some code wrapped in comment in blade was being executed, and The right code in blade is

@foreach($outs as $out)
   <tr>
     <td> {{ $out->client }} </td>
   </tr>
@endforeach
Related