public function postEditField($id, $field) { if (!array_key_exists($field, Team::$rulesAll)) { \App::abort(403, 'Unauthorized action.'); } $team = Team::find($id); if ($team === null) { return redirect('teams')->withError(trans('app.teamNotExists', ['id' => $id])); } $validator = Team::validate(Input::all(), $field); if ($validator->fails()) { return redirect()->route('team.edit', $team->id)->withErrors($validator->messages()->all()); } $team->{$field} = Input::get($field); $team->save(); return redirect()->route('team.edit', $team->id)->with('success', trans('app.updateSuccessful')); }