I have two queries looking at the model. The first one is working normally:
$pedidos = Pedido::
orwhere(function($query){
$query->where('user_id', $_SESSION['idUsuario'])
->where('status', 'Aberto');
})
->get();
The second however, is returning error from Undefined Variable: requestID.
$idUserPedido = $pedidos[0]['user_id'];
$idPedido = $pedidos[0]['id'];
$produtoDoPedido = PedidoProduto::orwhere(function($query){
$query->where('id',$_SESSION['idUsuario'])
->where('pedido_id', $idPedido);
})
->get();
When I echo the variable it returns the correct value. The var_dump returns a value as int.
Does anyone know if there are any restrictions to using variables in Eloquent?