Exemplo n.º 1
0
 /**
  * Process a form to edit an existing congregation.
  *
  * @param integer $id The id of the congregation to edit.
  *
  * @return mixed The response.
  */
 public function processEditCongregation($id)
 {
     try {
         // Get inputs.
         $congregation = new Congregation();
         $congregation->name = Input::get('name');
         $congregation->address = Input::get('address');
         $congregation->pm_day_of_week = Input::get('pm_day_of_week');
         $pmHours = Input::get('pm_datetime_hours');
         $pmMinutes = Input::get('pm_datetime_minutes');
         $congregation->pm_datetime = Carbon::createFromTime($pmHours, $pmMinutes, 0);
         // Update congregation.
         CongregationService::updateCongregation($id, $congregation);
         $this->success(trans('messages.congregationUpdated'));
         return Redirect::route('congregations.list');
     } catch (ValidationException $e) {
         return Redirect::route('congregations.edit')->withInput(Input::all())->withErrors($e->getValidator());
     } catch (Exception $e) {
         return $this->unexpected($e);
     }
 }