Skip to content

Commit

Permalink
Load currentTeam using setRelation (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
lexdewilligen authored Mar 17, 2021
1 parent 5f007c5 commit 8028279
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Http/Middleware/ShareInertiaData.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public function handle($request, $next)
}

if (Jetstream::hasTeamFeatures() && $request->user()) {
$request->user()->currentTeam;
$request->user()->setRelation('currentTeam', $request->user()->allTeams()->filter(function ($team) use ($request) {
return $team->id === $request->user()->current_team_id;
})->first());
}

return array_merge($request->user()->toArray(), array_filter([
Expand Down

0 comments on commit 8028279

Please sign in to comment.