the browser-facing portion of osu!
at master 56 lines 1.7 kB view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6namespace App\Transformers; 7 8use App\Models\User; 9use App\Models\UserProfileCustomization; 10 11class UserTransformer extends UserCompactTransformer 12{ 13 protected array $defaultIncludes = [ 14 'country', 15 'cover', 16 'is_admin', 17 'is_bng', 18 'is_full_bn', 19 'is_gmt', 20 'is_limited_bn', 21 'is_moderator', 22 'is_nat', 23 'is_restricted', 24 'is_silenced', 25 'kudosu', 26 ]; 27 28 public function transform(User $user) 29 { 30 $result = parent::transform($user); 31 32 $profileOrder = UserProfileCustomization::forUser($user)['extras_order']; 33 34 return [ 35 ...$result, 36 'cover_url' => $user->cover()->url(), // TODO: deprecated. 37 'discord' => $user->user_discord, 38 'has_supported' => $user->hasSupported(), 39 'interests' => $user->user_interests, 40 'join_date' => json_time($user->user_regdate), 41 'location' => $user->user_from, 42 'max_blocks' => $user->maxBlocks(), 43 'max_friends' => $user->maxFriends(), 44 'occupation' => $user->user_occ, 45 'playmode' => $user->playmode, 46 'playstyle' => $user->osu_playstyle, 47 'post_count' => $user->user_posts, 48 'profile_hue' => $user->user_style, 49 'profile_order' => $profileOrder, 50 'title' => $user->title(), 51 'title_url' => $user->titleUrl(), 52 'twitter' => $user->user_twitter, 53 'website' => $user->user_website, 54 ]; 55 } 56}