feat(api): add portal_events to auth/me endpoint
Add persons() relationship to User model and include portal_events array in MeResource response, mapping each person record to its event and organisation data for the portal frontend. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,12 @@ final class MeController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request): JsonResponse
|
||||
{
|
||||
$user = $request->user()->load(['organisations', 'roles', 'permissions']);
|
||||
$user = $request->user()->load([
|
||||
'organisations',
|
||||
'roles',
|
||||
'permissions',
|
||||
'persons' => fn ($q) => $q->with(['event:id,name,slug,start_date,end_date,organisation_id', 'event.organisation:id,name']),
|
||||
]);
|
||||
|
||||
return $this->success(new MeResource($user));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user