Closed codedninja closed 6 years ago
Reason why it failed originally is because $user->currentTeam now gives pivot data back.
@@ master #62 diff @@
==========================================
Files 14 14
Lines 349 351 +2
Methods 61 62 +1
Messages 0 0
Branches 0 0
==========================================
- Hits 263 259 -4
- Misses 86 92 +6
Partials 0 0
Powered by Codecov. Last update 39abad1...818f506
Thank you for the PR.
Wouldn't this break applications, that are using the relation to filter additional query parameters? For example:
$user->currentTeam()->where('foo', 'bar')->first();
This will no longer work, with your modification.
Just compared both old version and new version and seems to be find. Also don't think you need to do $user->currentTeam()->where('foo', 'bar')->first();
since you only returning one relation.
I saw the currentTeam implementation in another application and it worked perfectly. You can still do $user->currentTeam->name
or $user->currentTeam()->wherePivot('foo_id', 1)->first()
Closed due to inactivity.
While having issues trying to use
withPivot()
oncurrentTeam
it would just error out. Turns outhasOne
doesn't have that method so decided to fix the issue so you can grab data from the pivot table.