Ejemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 80; ++$i) {
         $aleatorio = $faker->numberBetween(1, 10);
         if ($aleatorio < 2) {
             $estado = 'Omitida';
         } elseif ($aleatorio < 10) {
             $estado = 'Atendida';
         } else {
             $estado = 'Pendiente';
         }
         Queja::create(['email' => $faker->email, 'estado' => $estado, 'descripcion' => $faker->sentence, 'created_at' => $estado == 'Pendiente' ? $faker->dateTimeBetween('-4 months', '-1 days') : $faker->dateTimeBetween('-1 years', '-1 days')]);
     }
 }
Ejemplo n.º 2
0
 public function calcIndiceAtencion(Request $request)
 {
     $inicio = $request->get('inicio');
     $fin = $request->get('fin');
     $atendidas = Queja::where('created_at', '>=', $inicio)->where('created_at', '<=', $fin)->where('estado', 'Atendida')->count();
     $omitidas = Queja::where('created_at', '>=', $inicio)->where('created_at', '<=', $fin)->where('estado', 'Omitida')->count();
     $pendientes = Queja::where('created_at', '>=', $inicio)->where('created_at', '<=', $fin)->where('estado', 'Pendiente')->count();
     $total = $atendidas + $omitidas + $pendientes;
     $respuesta['atendidas'] = 100 * $atendidas / $total;
     $respuesta['omitidas'] = 100 * $omitidas / $total;
     $respuesta['pendientes'] = 100 - $respuesta['atendidas'] - $respuesta['omitidas'];
     return $respuesta;
 }
Ejemplo n.º 3
0
 public function getQuejas()
 {
     $quejas = Queja::where('estado', 'Pendiente')->get();
     $q = 0;
     return view('queja.listar')->with(compact(['quejas', 'q']));
 }