the browser-facing portion of osu!
at master 48 lines 1.9 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\Libraries\Beatmapset\NominateBeatmapset; 9use App\Models\Beatmapset; 10 11class BeatmapsetTransformer extends BeatmapsetCompactTransformer 12{ 13 protected $beatmapTransformer = BeatmapTransformer::class; 14 15 protected array $defaultIncludes = [ 16 'availability', 17 'has_favourited', 18 ]; 19 20 protected $requiredPermission = 'BeatmapsetShow'; 21 22 public function transform(Beatmapset $beatmapset) 23 { 24 // only for showing in BeatmapPanel. 25 $nominationsSummary = [ 26 'current' => $beatmapset->nominations, 27 'eligible_main_rulesets' => $beatmapset->eligible_main_rulesets, 28 'required_meta' => NominateBeatmapset::requiredNominationsConfig(), 29 ]; 30 31 return array_merge(parent::transform($beatmapset), [ 32 'bpm' => $beatmapset->bpm, 33 'can_be_hyped' => $beatmapset->canBeHyped(), 34 'deleted_at' => $beatmapset->deleted_at_json, 35 'discussion_enabled' => true, // TODO: deprecated 2022-06-08 36 'discussion_locked' => $beatmapset->discussion_locked, 37 'is_scoreable' => $beatmapset->isScoreable(), 38 'last_updated' => $beatmapset->last_update_json, 39 'legacy_thread_url' => ($beatmapset->thread_id ?? 0) !== 0 ? route('forum.topics.show', ['topic' => $beatmapset->thread_id]) : null, 40 'nominations_summary' => $nominationsSummary, 41 'ranked' => $beatmapset->approved, 42 'ranked_date' => $beatmapset->approved_date_json, 43 'storyboard' => $beatmapset->storyboard, 44 'submitted_date' => $beatmapset->submit_date_json, 45 'tags' => $beatmapset->tags, 46 ]); 47 } 48}