public function EnviosDisC() { $usuarios = UsuariosHD::where('id', '=', Input::get('id'))->first(); $usuarios1 = UsuariosHD::where('id_restaurante', '=', Input::get('id_restaurante'))->first(); $pedido = Pedidos::All()->last(); $pedidos = Pedidos::Envios()->get(); foreach ($pedidos as $key2 => $value2) { $validacion = hd::where('id_restaurante', '=', $value2->id_restaurante)->get(); $valor = 0; $envios = Envios::EnviosDis2($value2->id_restaurante)->get(); foreach ($validacion as $key2 => $info2) { if ($info2->decision == 0) { if ($usuarios->id_restaurante == $value2->id_restaurante or $usuarios->id_restaurante2 == $value2->id_restaurante) { return Response::json($envios); } } if ($info2->decision == 1) { if ($usuarios->id_restaurante == $value2->id_restaurante or $usuarios->id_restaurante2 == $value2->id_restaurante or $usuarios->id_restaurante == 0 or $usuarios->id_restaurante2 == 0) { return Response::json($envios); } } } } return Response::json('ERROR GENERAL'); }