/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $dia = DiaInhabil::find($id);
     if (is_null($dia)) {
         return \Redirect::route('diainhabil.index')->withErrors(['error' => "El día enviado no existe"]);
     }
     $dia->delete();
     return \Redirect::route('diainhabil.index')->with('message', 'El día inhábil fue eliminado con éxito.');
 }
 protected function buscarFechaDisponible()
 {
     //Obtengo la fecha y hora actual y le agrego un dia
     $fechaManana = Carbon::now()->addDay()->toDateString();
     $horaActual = Carbon::now()->addHour()->format('H');
     $now = Carbon::createFromFormat('Y-m-d H:i', $fechaManana . $horaActual . ":00");
     $fechaDisponible = false;
     $fechaRevisar = $now;
     while (!$fechaDisponible) {
         if ($fechaRevisar->isWeekend() or !is_null(DiaInhabil::whereFecha($fechaRevisar->toDateString())->first())) {
             $fechaRevisar = $fechaRevisar->addDay();
         } else {
             if ($this->esFechaValida($fechaRevisar)) {
                 $fechaDisponible = true;
             } else {
                 $fechaRevisar = $fechaRevisar->addHour();
             }
         }
     }
     return $fechaRevisar->toDateTimeString();
 }
 protected function esDiaInhabil($fecha)
 {
     $fechaInhabil = DiaInhabil::whereFecha($fecha)->first();
     if (is_null($fechaInhabil)) {
         return false;
     } else {
         return true;
     }
 }