Skip to main content
deleted 4 characters in body
Source Link
Andreas
  • 2.7k
  • 2
  • 22
  • 33

If the office and date keys are the same (which I assume), you could try that:

public function postDisableDates() {

  $input = Input::all();  

  DB::table('bk_disable_date')
    ->delete();

  foreach($input['date'] as $key => $date) {

    $db_date = strtotime($date);
    $dateFormat = date('Y-m-d', strtotime("-1 month", $db_date));

    DB::table('bk_disable_date')
      ->delete();

    DB::table('bk_disable_date')
      ->insert(array(
        'date' => $dateFormat,
        'office' => $input['office'][$key]
      )
    );                     
  }       
}

Hope that helps

If the office and date keys are the same (which I assume), you could try that:

public function postDisableDates() {

  $input = Input::all();  

  foreach($input['date'] as $key => $date) {

    $db_date = strtotime($date);
    $dateFormat = date('Y-m-d', strtotime("-1 month", $db_date));

    DB::table('bk_disable_date')
      ->delete();

    DB::table('bk_disable_date')
      ->insert(array(
        'date' => $dateFormat,
        'office' => $input['office'][$key]
      )
    );                     
  }       
}

Hope that helps

If the office and date keys are the same (which I assume), you could try that:

public function postDisableDates() {

  $input = Input::all();  

  DB::table('bk_disable_date')
    ->delete();

  foreach($input['date'] as $key => $date) {

    $db_date = strtotime($date);
    $dateFormat = date('Y-m-d', strtotime("-1 month", $db_date));

    DB::table('bk_disable_date')
      ->insert(array(
        'date' => $dateFormat,
        'office' => $input['office'][$key]
      )
    );                     
  }       
}

Hope that helps

Source Link
Andreas
  • 2.7k
  • 2
  • 22
  • 33

If the office and date keys are the same (which I assume), you could try that:

public function postDisableDates() {

  $input = Input::all();  

  foreach($input['date'] as $key => $date) {

    $db_date = strtotime($date);
    $dateFormat = date('Y-m-d', strtotime("-1 month", $db_date));

    DB::table('bk_disable_date')
      ->delete();

    DB::table('bk_disable_date')
      ->insert(array(
        'date' => $dateFormat,
        'office' => $input['office'][$key]
      )
    );                     
  }       
}

Hope that helps