the browser-facing portion of osu!
at master 1.5 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 Database\Factories; 7 8use App\Models\BeatmapDiscussion; 9 10class BeatmapDiscussionFactory extends Factory 11{ 12 // TODO: decouple message_type 13 const DEFAULTS = [ 14 'general' => [ 15 'timestamp' => null, 16 'message_type' => 'problem', 17 ], 18 'review' => [ 19 'timestamp' => null, 20 'message_type' => 'review', 21 ], 22 'timeline' => [ 23 'timestamp' => 0, 24 'message_type' => 'problem', 25 ], 26 ]; 27 28 protected $model = BeatmapDiscussion::class; 29 30 public function definition(): array 31 { 32 return array_merge(array_rand_val(static::DEFAULTS), [ 33 'resolved' => false, 34 ]); 35 } 36 37 public function general() 38 { 39 return $this->state(static::DEFAULTS['general']); 40 } 41 42 public function mapperNote() 43 { 44 return $this->messageType('mapper_note'); 45 } 46 47 public function messageType(string $type) 48 { 49 return $this->state(['message_type' => $type]); 50 } 51 52 public function problem() 53 { 54 return $this->messageType('problem'); 55 } 56 57 public function review() 58 { 59 return $this->state(static::DEFAULTS['review']); 60 } 61 62 public function timeline() 63 { 64 return $this->state(static::DEFAULTS['timeline']); 65 } 66}