5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Foundation\Auth\User as Authenticatable;
7 use Illuminate\Notifications\Notifiable;
8 use Laravel\Sanctum\HasApiTokens;
11 class User extends Authenticatable
13 use HasApiTokens, HasFactory, Notifiable;
15 public function isParticipant(Tournament $tournament) {
16 foreach ($tournament->participants as $participant) {
17 if ($participant->user_id == $this->id) {
24 public function isRunner(Tournament $tournament) {
25 foreach ($tournament->participants as $participant) {
26 if ($participant->user_id == $this->id) {
27 return in_array('runner', $participant->roles);
33 public function isTournamentAdmin(Tournament $tournament) {
34 foreach ($tournament->participants as $participant) {
35 if ($participant->user_id == $this->id) {
36 return in_array('admin', $participant->roles);
42 public function participation() {
43 return $this->hasMany(Participant::class);
47 * The attributes that are mass assignable.
51 protected $fillable = [
65 * The attributes that should be hidden for serialization.
77 * The attributes that should be cast.
83 'username' => 'string',
84 'discriminator' => 'string',
87 'verified' => 'boolean',
89 'mfa_enabled' => 'boolean',
90 'refresh_token' => 'encrypted',