/**
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function saveConfigDepartCreeFlights()
 {
     $id = 'id';
     $model = 'Configdepart';
     $route = Input::get('backUrl');
     $page = '';
     // Configdepart New or Create
     if (Input::get($id) == 0) {
         $mod = new $model();
     } else {
         $mod = $model::find(Input::get($id));
     }
     // Tranform Date to MySql format
     transformMySqlDates($mod);
     // Save compet & call create tours
     if ($mod->save()) {
         $savedFlights = $this->saveFlights($mod);
         if ($route == '') {
             return $mod->id;
         } else {
             return Redirect::route('tour.open');
         }
     } else {
         return Redirect::back()->withErrors($mod->errors())->withInput();
     }
 }
Example #2
0
 /**
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function skipStore()
 {
     $id = 'id';
     $model = 'Compet';
     $route = Input::get('backUrl');
     $page = '';
     // Compet New or Create
     if (Input::get($id) == 0) {
         $mod = new $model();
     } else {
         $mod = $model::find(Input::get($id));
     }
     // Tranform Date to MySql format
     transformMySqlDates($mod);
     // Save compet & call create tours
     if ($mod->save()) {
         $savedTour = $this->saveTour($mod);
         if ($route == '') {
             return $mod->id;
         } else {
             return Redirect::to('tour/formule/' . $route . '/' . $mod->id);
         }
     } else {
         return Redirect::back()->withErrors($mod->errors())->withInput();
     }
 }
Example #3
0
/**
 * @param $id
 * @param $model
 * @param $route
 * @param string $page
 * @return $this|\Illuminate\Http\RedirectResponse
 */
function getModelNewOrEdit($id, $model, $route, $page = '')
{
    if (Input::get($id) == 0) {
        $mod = new $model();
    } else {
        $mod = $model::find(Input::get($id));
    }
    // Transform date to MySql format
    transformMySqlDates($mod);
    if ($mod->save()) {
        if ($route == '') {
            return $mod->id;
        } else {
            return Redirect::route($route, [$page]);
        }
    } else {
        return Redirect::back()->withErrors($mod->errors())->withInput();
    }
}