public function postConfigDaySave()
 {
     /*-------------------Domingo-----------------------------*/
     $configDay = Configday::where('day', 'Sunday')->where('agenda_id', Input::get("agenda"))->first();
     if (!$configDay) {
         $configDay = new Configday();
     }
     $configDay->agenda_id = Input::get("agenda");
     $configDay->day = 'Sunday';
     $configDay->starttime_am = CustomDay::eliminarespacios(Input::get("starttime_am"));
     $configDay->endtime_am = CustomDay::eliminarespacios(Input::get("endtime_am"));
     $configDay->lunch_start = CustomDay::eliminarespacios(Input::get("lunch_start"));
     $configDay->lunch_end = CustomDay::eliminarespacios(Input::get("lunch_end"));
     $configDay->starttime_pm = CustomDay::eliminarespacios(Input::get("starttime_pm"));
     $configDay->endtime_pm = CustomDay::eliminarespacios(Input::get("endtime_pm"));
     $configDay->is_day_off = Input::get("is_day_off");
     $configDay->save();
     /*-------------------Lunes-----------------------------*/
     $configDay1 = Configday::where('day', 'Monday')->where('agenda_id', Input::get("agenda"))->first();
     if (!$configDay1) {
         $configDay1 = new Configday();
     }
     $configDay1->agenda_id = Input::get("agenda");
     $configDay1->day = 'Monday';
     $configDay1->starttime_am = CustomDay::eliminarespacios(Input::get("starttime_am_1"));
     $configDay1->endtime_am = CustomDay::eliminarespacios(Input::get("endtime_am_1"));
     $configDay1->lunch_start = CustomDay::eliminarespacios(Input::get("lunch_start_1"));
     $configDay1->lunch_end = CustomDay::eliminarespacios(Input::get("lunch_end_1"));
     $configDay1->starttime_pm = CustomDay::eliminarespacios(Input::get("starttime_pm_1"));
     $configDay1->endtime_pm = CustomDay::eliminarespacios(Input::get("endtime_pm_1"));
     $configDay1->is_day_off = Input::get("is_day_off_1");
     $configDay1->save();
     /*-------------------Martes-----------------------------*/
     $configDay2 = Configday::where('day', 'Tuesday')->where('agenda_id', Input::get("agenda"))->first();
     if (!$configDay2) {
         $configDay2 = new Configday();
     }
     $configDay2->agenda_id = Input::get("agenda");
     $configDay2->day = 'Tuesday';
     $configDay2->starttime_am = CustomDay::eliminarespacios(Input::get("starttime_am_2"));
     $configDay2->endtime_am = CustomDay::eliminarespacios(Input::get("endtime_am_2"));
     $configDay2->lunch_start = CustomDay::eliminarespacios(Input::get("lunch_start_2"));
     $configDay2->lunch_end = CustomDay::eliminarespacios(Input::get("lunch_end_2"));
     $configDay2->starttime_pm = CustomDay::eliminarespacios(Input::get("starttime_pm_2"));
     $configDay2->endtime_pm = CustomDay::eliminarespacios(Input::get("endtime_pm_2"));
     $configDay2->is_day_off = Input::get("is_day_off_2");
     $configDay2->save();
     /*-------------------Miercoles-----------------------------*/
     $configDay3 = Configday::where('day', 'Wednesday')->where('agenda_id', Input::get("agenda"))->first();
     if (!$configDay3) {
         $configDay3 = new Configday();
     }
     $configDay3->agenda_id = Input::get("agenda");
     $configDay3->day = 'Wednesday';
     $configDay3->starttime_am = CustomDay::eliminarespacios(Input::get("starttime_am_3"));
     $configDay3->endtime_am = CustomDay::eliminarespacios(Input::get("endtime_am_3"));
     $configDay3->lunch_start = CustomDay::eliminarespacios(Input::get("lunch_start_3"));
     $configDay3->lunch_end = CustomDay::eliminarespacios(Input::get("lunch_end_3"));
     $configDay3->starttime_pm = CustomDay::eliminarespacios(Input::get("starttime_pm_3"));
     $configDay3->endtime_pm = CustomDay::eliminarespacios(Input::get("endtime_pm_3"));
     $configDay3->is_day_off = Input::get("is_day_off_3");
     $configDay3->save();
     /*-------------------Jueves-----------------------------*/
     $configDay4 = Configday::where('day', 'Thursday')->where('agenda_id', Input::get("agenda"))->first();
     if (!$configDay4) {
         $configDay4 = new Configday();
     }
     $configDay4->agenda_id = Input::get("agenda");
     $configDay4->day = 'Thursday';
     $configDay4->starttime_am = CustomDay::eliminarespacios(Input::get("starttime_am_4"));
     $configDay4->endtime_am = CustomDay::eliminarespacios(Input::get("endtime_am_4"));
     $configDay4->lunch_start = CustomDay::eliminarespacios(Input::get("lunch_start_4"));
     $configDay4->lunch_end = CustomDay::eliminarespacios(Input::get("lunch_end_4"));
     $configDay4->starttime_pm = CustomDay::eliminarespacios(Input::get("starttime_pm_4"));
     $configDay4->endtime_pm = CustomDay::eliminarespacios(Input::get("endtime_pm_4"));
     $configDay4->is_day_off = Input::get("is_day_off_4");
     $configDay4->save();
     /*-------------------Viernes-----------------------------*/
     $configDay5 = Configday::where('day', 'Friday')->where('agenda_id', Input::get("agenda"))->first();
     if (!$configDay5) {
         $configDay5 = new Configday();
     }
     $configDay5->agenda_id = Input::get("agenda");
     $configDay5->day = 'Friday';
     $configDay5->starttime_am = CustomDay::eliminarespacios(Input::get("starttime_am_5"));
     $configDay5->endtime_am = CustomDay::eliminarespacios(Input::get("endtime_am_5"));
     $configDay5->lunch_start = CustomDay::eliminarespacios(Input::get("lunch_start_5"));
     $configDay5->lunch_end = CustomDay::eliminarespacios(Input::get("lunch_end_5"));
     $configDay5->starttime_pm = CustomDay::eliminarespacios(Input::get("starttime_pm_5"));
     $configDay5->endtime_pm = CustomDay::eliminarespacios(Input::get("endtime_pm_5"));
     $configDay5->is_day_off = Input::get("is_day_off_5");
     $configDay5->save();
     /*-------------------Sabado-----------------------------*/
     $configDay6 = Configday::where('day', 'Saturday')->where('agenda_id', Input::get("agenda"))->first();
     if (!$configDay6) {
         $configDay6 = new Configday();
     }
     $configDay6->agenda_id = Input::get("agenda");
     $configDay6->day = 'Saturday';
     $configDay6->starttime_am = CustomDay::eliminarespacios(Input::get("starttime_am_6"));
     $configDay6->endtime_am = CustomDay::eliminarespacios(Input::get("endtime_am_6"));
     $configDay6->lunch_start = CustomDay::eliminarespacios(Input::get("lunch_start_6"));
     $configDay6->lunch_end = CustomDay::eliminarespacios(Input::get("lunch_end_6"));
     $configDay6->starttime_pm = CustomDay::eliminarespacios(Input::get("starttime_pm_6"));
     $configDay6->endtime_pm = CustomDay::eliminarespacios(Input::get("endtime_pm_6"));
     $configDay6->is_day_off = Input::get("is_day_off_6");
     $configDay6->save();
     return Redirect::back();
 }
 public function getAgendaDay()
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $id = Doctor::doctorLogin();
     $agenda = Agenda::where('doctor_id', $id)->first();
     $dt = Carbon::now();
     $bussi = Business::where('agenda_id', $agenda->id)->first()->id;
     if ($dt->dayOfWeek == 0) {
         $dia = 'Sunday';
     } elseif ($dt->dayOfWeek == 1) {
         $dia = 'Monday';
     } elseif ($dt->dayOfWeek == 2) {
         $dia = 'Tuesday';
     } elseif ($dt->dayOfWeek == 3) {
         $dia = 'Wednesday';
     } elseif ($dt->dayOfWeek == 4) {
         $dia = 'Thursday';
     } elseif ($dt->dayOfWeek == 5) {
         $dia = 'Friday';
     } else {
         $dia = 'Saturday';
     }
     $CustomDay = CustomDay::where('agenda_id', $agenda->id)->get();
     $Configday = Configday::where('day', $dia)->where('agenda_id', $agenda->id)->first();
     $AgendaAppo = Appointment::where('agenda_id', $agenda->id)->get();
     return View::make('clinic.doctor.Appointments.AppointmentsDay')->with('agendaAppo', $AgendaAppo)->with('configday', $Configday)->with('customddays', $CustomDay)->with('bussi', $bussi)->with('agenda', $agenda);
 }