we return the request's authenticated user // - The method is called from a guest route > we fetch a possible registered user $user = $request->user() ?: User::first(); return $user ? new UserResource($user) : response()->json(['name' => null], 200); } }