app/User.php
public function setPreference(string $setting_name, string $setting_value): UserInterface
    {
        if ($this->user_id !== 0 && $this->getPreference($setting_name) !== $setting_value) {
            DB::table('user_setting')->updateOrInsert([
                'user_id'      => $this->user_id,
                'setting_name' => $setting_name,
            ], [
                'setting_value' => $setting_value,
            ]);

            $this->preferences[$setting_name] = $setting_value;
        }

        app('cache.array')->forget('user_setting' . $this->user_id);

        return $this;
    }
public function setPreference(string $setting_name, string $setting_value): UserInterface
    {
        if ($this->user_id !== 0 && $this->getPreference($setting_name) !== $setting_value) {
            DB::table('user_setting')->updateOrInsert([
                'user_id'      => $this->user_id,
                'setting_name' => $setting_name,
            ], [
                'setting_value' => $setting_value,
            ]);

            $this->preferences[$setting_name] = $setting_value;
        }

        app('cache.array')->forget('user_setting' . $this->user_id);

        return $this;
    }
public function setPreference ( string $ setting_name , string $ setting_value ) : UserInterface { if ( $ this -> user_id !== 0 && $ this -> getPreference ( $ setting_name ) !== $ setting_value ) { DB :: table ( 'user_setting' ) -> updateOrInsert ( [ 'user_id' => $ this -> user_id , 'setting_name' => $ setting_name , ] , [ 'setting_value' => $ setting_value , ] ) ; $ this -> preferences [ $ setting_name ] = $ setting_value ; } app ( 'cache.array' ) -> forget ( 'user_setting' . $ this -> user_id ) ; return $ this ; }
Update a setting for the user.

@param string $setting_name
@param string $setting_value

@return UserInterface
Update a setting for the user .