app/User.php
public function setUserName($user_name): self
    {
        if ($this->user_name !== $user_name) {
            $this->user_name = $user_name;

            DB::table('user')
                ->where('user_id', '=', $this->user_id)
                ->update([
                    'user_name' => $user_name,
                ]);
        }

        return $this;
    }
public function setUserName($user_name): self
    {
        if ($this->user_name !== $user_name) {
            $this->user_name = $user_name;

            DB::table('user')
                ->where('user_id', '=', $this->user_id)
                ->update([
                    'user_name' => $user_name,
                ]);
        }

        return $this;
    }
public function setUserName ( $ user_name ) : self { if ( $ this -> user_name !== $ user_name ) { $ this -> user_name = $ user_name ; DB :: table ( 'user' ) -> where ( 'user_id' , '=' , $ this -> user_id ) -> update ( [ 'user_name' => $ user_name , ] ) ; } return $ this ; }
Set the login name for this user.

@param string $user_name

@return $this
Set the login name for this user .