return in_array('admin', $this->roles);
}
+ public function makeRunner() {
+ if (!is_array($this->roles)) {
+ $this->roles = ['runner'];
+ } else if (!in_array('runner', $this->roles)) {
+ $newRoles = array_values($this->roles);
+ $newRoles[] = 'runner';
+ $this->roles = $newRoles;
+ }
+ $this->save();
+ ParticipantChanged::dispatch($this);
+ }
+
public function tournament() {
return $this->belongsTo(Tournament::class);
protected $casts = [
'roles' => 'array',
+ 'user_id' => 'string',
+ ];
+
+ protected $fillable = [
+ 'tournament_id',
+ 'user_id',
];
protected $with = [