flarum-users-map-location/src/Listeners/AddLocationAttribute.php

24 lines
747 B
PHP
Raw Normal View History

2022-02-05 14:45:41 +00:00
<?php
namespace Justoverclock\UsersMapLocation\Listeners;
use Flarum\Api\Serializer\UserSerializer;
use Flarum\User\User;
class AddLocationAttribute
{
public function __invoke(UserSerializer $serializer, User $user, array $attributes): array
{
$actor = $serializer->getActor();
$attributes['location_city'] = $user->location_city;
$attributes['location_postcode'] = $user->location_postcode;
$attributes['location_countrycode'] = $user->location_countrycode;
$attributes['location_country'] = $user->location_country;
$attributes['location_longitude'] = $user->location_longitude;
$attributes['location_latitude'] = $user->location_latitude;
2022-02-05 14:45:41 +00:00
return $attributes;
}
}