public function update($id)
    {
        $model = ApiUsers::query()->findOrFail($id);
        $form  = $this->getForm($model);
        $url   = url()->previous();
        if (!$form->isValid()) {
            return $this->redirectWithErrors($url, $form->getMessageBag());
        }
        $model->enabled = input('api', 'off') === 'on';
        if (!is_null($whitelist      = input('whitelist'))) {
            $model->whitelist = $whitelist;
        }
        if (!$model->save()) {
            return $this->redirectWithMessage($url, trans('antares/api::response.user_config_not_saved'), 'error');
        }
        return $this->redirectWithMessage($url, trans('antares/api::response.user_config_saved'));
    }
public function update($id)
    {
        $model = ApiUsers::query()->findOrFail($id);
        $form  = $this->getForm($model);
        $url   = url()->previous();
        if (!$form->isValid()) {
            return $this->redirectWithErrors($url, $form->getMessageBag());
        }
        $model->enabled = input('api', 'off') === 'on';
        if (!is_null($whitelist      = input('whitelist'))) {
            $model->whitelist = $whitelist;
        }
        if (!$model->save()) {
            return $this->redirectWithMessage($url, trans('antares/api::response.user_config_not_saved'), 'error');
        }
        return $this->redirectWithMessage($url, trans('antares/api::response.user_config_saved'));
    }
public function update ( $ id ) { $ model = ApiUsers :: query ( ) -> findOrFail ( $ id ) ; $ form = $ this -> getForm ( $ model ) ; $ url = url ( ) -> previous ( ) ; if ( ! $ form -> isValid ( ) ) { return $ this -> redirectWithErrors ( $ url , $ form -> getMessageBag ( ) ) ; } $ model -> enabled = input ( 'api' , 'off' ) === 'on' ; if ( ! is_null ( $ whitelist = input ( 'whitelist' ) ) ) { $ model -> whitelist = $ whitelist ; } if ( ! $ model -> save ( ) ) { return $ this -> redirectWithMessage ( $ url , trans ( 'antares/api::response.user_config_not_saved' ) , 'error' ) ; } return $ this -> redirectWithMessage ( $ url , trans ( 'antares/api::response.user_config_saved' ) ) ; }
Updates user api configuration

@param type $id
@return \Illuminate\Http\RedirectResponse
Updates user api configuration