public function getIndex() { if (session('level') > 3) { $contr = Contribuyente::all(); } else { $contr = Contribuyente::where('user_id', '=', session('id'))->get(); } return view('buscar', compact('contr')); }
public function getEditar() { $user = User::find(session('id')); if (session('level') > 3) { $contribuyentes = Contribuyente::all(); } else { $contribuyentes = Contribuyente::where('user_id', '=', session('id'))->get(); } return view('contribuyentes.editar', compact('contribuyentes')); }
public function getIndex() { $id = session('id'); $carga = Cargas::where('user_id', '=', $id)->where('procesado', '=', false)->first(); if (!$carga) { $carga = Cargas::create(['user_id' => $id]); } if (session('level') > 3) { $contribuyentes = Contribuyente::all(); } else { $contribuyentes = Contribuyente::where('user_id', '=', session('id'))->get(); } $contri = $carga->contribuyente; $anio = $carga->anio; $mes = $carga->mes; return view('cargar.cargar', compact('contribuyentes', 'contri', 'anio', 'mes')); }
/** * Execute the console command. * * @return mixed */ public function handle() { $contribuyentes = Contribuyente::all(); foreach ($contribuyentes as $contr) { $nuevasCanceladas = []; $listSat = ArchivoSat::where(function ($q) use($contr) { $q->where('rfc_emisor', '=', $contr)->orWhere('rfc_receptor', '=', $contr); })->lists('uuid'); $archivosEmpresa = ArchivoEmpresa::where(function ($q) use($contr) { $q->where('rfc_emisor', '=', $contr)->orWhere('rfc_receptor', '=', $contr); })->whereNotIn('uuid', $listSat)->get(); $archivosSat = ArchivoSat::whereIn('uuid', $listSat)->get(); $archivos = $archivosSat->merge($archivosEmpresa); foreach ($archivos as $datos) { $servidorSat = new ConsultarSat($datos->uuid, $datos->rfc_emisor, $datos->rfc_receptor, $datos->total); $servidorSat->hacerPeticion(); if ($servidorSat->fueCanceladaRecientemente()) { $nuevasCanceladas[] = array('uuid' => $datos->uuid, 'contribuyente' => $contr->nombre, 'rfc' => $contr->rfc); } } } }