public function index() { $this->vars['deptos'] = Departamento::all(); $this->vars['municipios'] = array(); $this->vars['institutos'] = array(); $this->vars['vals_depto'] = DB::table('netsti_vaclases_validacion')->select(DB::raw('count(1) as val,tipo, dias, municipio_id, departamento_id, centro_educativo_id, netsti_vaclases_departamentos.nombre as nombre'))->join('netsti_vaclases_centros_educativos', 'centro_educativo_id', '=', 'netsti_vaclases_centros_educativos.id')->join('netsti_vaclases_departamentos', 'departamento_id', '=', 'netsti_vaclases_departamentos.id')->where('tipo', 1)->groupBy('departamento_id')->get(); $this->vars['vals_depto_q'] = DB::table('netsti_vaclases_validacion')->select(DB::raw('count(1) as val,tipo, dias, municipio_id, departamento_id, centro_educativo_id, netsti_vaclases_departamentos.nombre as nombre'))->join('netsti_vaclases_centros_educativos', 'centro_educativo_id', '=', 'netsti_vaclases_centros_educativos.id')->join('netsti_vaclases_departamentos', 'departamento_id', '=', 'netsti_vaclases_departamentos.id')->where('tipo', 2)->groupBy('departamento_id')->get(); if ($id = post('depto')) { $this->vars['vals_municipios'] = DB::table('netsti_vaclases_validacion')->select(DB::raw('count(1) as val,tipo, dias, municipio_id, netsti_vaclases_centros_educativos.departamento_id, centro_educativo_id, netsti_vaclases_municipios.nombre'))->join('netsti_vaclases_centros_educativos', 'centro_educativo_id', '=', 'netsti_vaclases_centros_educativos.id')->join('netsti_vaclases_municipios', 'municipio_id', '=', 'netsti_vaclases_municipios.id')->where('tipo', 1)->where('netsti_vaclases_centros_educativos.departamento_id', $id)->groupBy('municipio_id')->get(); $this->vars['vals_municipios_q'] = DB::table('netsti_vaclases_validacion')->select(DB::raw('count(1) as val,tipo, dias, municipio_id, netsti_vaclases_centros_educativos.departamento_id, centro_educativo_id, netsti_vaclases_municipios.nombre'))->join('netsti_vaclases_centros_educativos', 'centro_educativo_id', '=', 'netsti_vaclases_centros_educativos.id')->join('netsti_vaclases_municipios', 'municipio_id', '=', 'netsti_vaclases_municipios.id')->where('tipo', 2)->where('netsti_vaclases_centros_educativos.departamento_id', $id)->groupBy('municipio_id')->get(); $this->vars['municipios'] = Departamento::find($id)->municipios; $this->vars['lugar'] = Departamento::find($id)->nombre; $this->vars['sublugar'] = "Departamento"; } if ($id = post('municipio')) { $this->vars['institutos'] = Municipio::find($id)->institutos; $this->vars['lugar'] = Municipio::find($id)->nombre; $this->vars['sublugar'] = Departamento::find(post('depto'))->nombre; $this->vars['vals_institutos'] = DB::table('netsti_vaclases_validacion')->select(DB::raw('count(1) as val,tipo, dias, municipio_id, departamento_id, centro_educativo_id, codigo, nombre'))->join('netsti_vaclases_centros_educativos', 'centro_educativo_id', '=', 'netsti_vaclases_centros_educativos.id')->where('municipio_id', $id)->groupBy('centro_educativo_id')->get(); } if ($id = post('instituto')) { $this->vars['instituto'] = CentroEducativo::find($id); } return $this->makePartial('dashboard'); }
return json_encode(["encode" => base64_encode($text)]); }); Route::get('decode/{text}', function ($text) { return json_encode(["encode" => base64_decode($text)]); }); Route::get('encargado/{id}', function ($id) { return Encargado::where('id', $id)->orWhere('identidad', $id)->with('alumnos', 'alumnos.centro_educativo', 'alumnos.centro_educativo.municipio', 'alumnos.centro_educativo.departamento')->get(); }); Route::get('alumnos/{id}', function ($id) { return Alumno::where('id', $id)->orWhere('identidad', $id)->with('encargado')->get(); }); Route::get('municipio/{id}', function ($id) { return Municipio::where('id', $id)->with('departamento')->get(); }); Route::get('departamento/{id}', function ($id) { return Departamento::where('id', $id)->with('municipios')->get(); }); }); // API Route::group(['prefix' => 'api'], function () { Route::get('encargado', function () { $r = checkSesion(); if ($r["status"] == "error") { return $r; } return ["status" => "exito", "data" => Session::get('encargado')]; }); Route::get('mensajes', function () { $r = checkSesion(); if ($r["status"] == "error") { return $r;