Skip to content

Conversation

@finagin
Copy link
Contributor

@finagin finagin commented Dec 20, 2020

This change helpful to use the method in pipeline like this:

    public function initializeUsesUuid()
    {
        $this
            ->setKeyName('uuid')
            ->setKeyType('string')
            ->setIncrementing(false)
            ->mergeCasts([$this->getKeyName() => $this->getKeyType()])
            ->mergeGuarded([$this->getKeyName()]);
    }

@GrahamCampbell GrahamCampbell changed the title Returns self after merge casts [9.x] Modify mergeCasts to return $this Dec 20, 2020
@taylorotwell taylorotwell merged commit 2dc6ce5 into laravel:master Dec 20, 2020
@dinhquochan
Copy link
Contributor

@taylorotwell Can merge this into 8.x? Because It's not breaking changes (not much).

// before
public function initializeUsesUuid()
{
        $this->setKeyType('string')
            ->setIncrementing(false);
        $this->mergeCasts([$this->getKeyName() => $this->getKeyType()]);
}

// after
public function initializeUsesUuid()
{
        $this->setKeyType('string')
            ->setIncrementing(false)
            ->mergeCasts([$this->getKeyName() => $this->getKeyType()]);
}

@driesvints
Copy link
Member

@dinhquochan feel free to pr

@finagin
Copy link
Contributor Author

finagin commented Dec 21, 2020

@driesvints, hey, I create this PR to 8.x (#35676), but it's rejected

@driesvints
Copy link
Member

@finagin that PR shouldn't have been closed. Feel free to resubmit it.

@finagin
Copy link
Contributor Author

finagin commented Dec 21, 2020

@driesvints I can't reopen #35676 but open new PR #35683

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants