Good morning everyone
I have the following problem: from the url I pick up a id with which I make a query from which I take out an array. With this array I make another query to get the data I need in another table. The problem comes to me when displaying the data in the view, it only returns a value to me, while doing an echo from the foreach of the controller shows me all the values.
Driver
public function mostrarFacturas($id){
$tienes = Tiene::where('idrc',$id)->select('idfactura')->get();
foreach ($tienes as $tiene => $valor) {
$facturas = Factura::select('id' ,'nfactura', 'importe' ,'fecha')
->whereIn('id' , [$valor->idfactura])->get();
echo $facturas;
dd($facturas);
}
return view('rc.showFacturas' , [
'tienes' => $tienes,
'facturas' => $facturas ]);
}
Content template
@extends('layouts.menuarea')
@section('content')
@foreach($facturas as $factura)
{{$factura}}
@endforeach
@stop
On the other hand if I make a dd ($ invoices) from the foreach I only receive a value.
Also I'm not sure I'm using the whereIn correctly. I appreciate any help.