Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newPivot method is the same as Laravel #185

Closed
wants to merge 8 commits into from
Closed

Conversation

mjauvin
Copy link
Member

@mjauvin mjauvin commented Jul 30, 2024

No need to duplicate the same code here.

@mjauvin mjauvin added this to the 1.2.7 milestone Jul 30, 2024
@mjauvin mjauvin requested a review from LukeTowers July 30, 2024 13:32
@mjauvin mjauvin self-assigned this Jul 30, 2024
@LukeTowers
Copy link
Member

LukeTowers commented Jul 30, 2024

use Storm's pivot model

That commit explains why we have this method. The code is the same visually, but by having the override here we are returning a Winter\Storm\Database\Pivot which extends Winter\Storm\Database\Model instead of a Illuminate\Database\Eloquent\Relations\Pivot which extends Illuminate\Database\Eloquent\Model.

@@ -148,7 +148,7 @@ public function newQueryForRestoration($ids)
}

if (!str_contains($ids, ':')) {
return parent::newQueryForRestoration($ids);
return parent::newQueryForRestoration([$ids]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches Laravel's code exactly, so I'm fine not making this change. Really what should be changed is the docblock in Laravel's code.

@LukeTowers LukeTowers closed this Jul 30, 2024
@LukeTowers LukeTowers deleted the laravel-sync branch July 30, 2024 15:37
@LukeTowers LukeTowers removed this from the 1.2.7 milestone Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants