public function update($accountId) { $rule = $this->rules; $rule['username'][2] .= ',' . $accountId; $validator = Validator::make(Input::all(), $rule); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } else { $game = Game::findOrFail(Input::get('game_id')); $user = User::findOrFail(Input::get('user_id')); $account = Account::findOrFail($accountId); $account->username = Input::get('username'); $account->password = Input::get('password'); $account->user_id = $user->id; $account->game_id = $game->id; $account->save(); return Redirect::to(route('admin.account.show', $account->id)); } }