hasOne(Contact::class) ->withDefault(); } /** * @return HasOne */ public function personalData() { return $this ->hasOne(PersonalData::class) ->withDefault(); } /** * The permissions that the user has * * @return HasManyDeep */ public function permissions() { return $this->hasManyDeepFromRelations($this->roles(), (new Role)->permissions()); } /** * The roles that belong to the user * * @return HasManyDeep */ public function roles() { return $this->hasManyDeepFromRelations($this->teams(), (new Team)->roles()); } /** * The teams that are supported by the user * * @return BelongsToMany */ public function supports() { return $this ->belongsToMany(Team::class, 'supporter_team') ->withTimestamps(); } /** * The teams that belong to the user * * @return BelongsToMany */ public function teams() { return $this ->belongsToMany(Team::class) ->withPivot(['confirmed']) ->withTimestamps(); } /** * @return HasOne */ public function settings() { return $this ->hasOne(Settings::class) ->withDefault(); } /** * @return HasOne */ public function state() { return $this ->hasOne(State::class) ->withDefault(); } }