$options */ trait UserAdjustments { use HasRoles; use RoleCheckers; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'phone_verified_at' => 'datetime', 'password_must_be_changed' => 'bool', 'must_fill_profile' => 'bool', 'options' => 'array', 'custom_fields' => 'array', 'password' => 'hashed', ]; } /** * Get option from options */ public function getOption(string $option): null|int|string { return $this->options && array_key_exists($option, $this->options) ? $this->options[$option] : ''; } /** * Passport serie */ public function passport_serie(): string { return (string) $this->getOption('passport_serie'); } /** * Passport id */ public function passport_id(): string { return (string) $this->getOption('passport_id'); } /** * Branches associated with user */ public function branches(): BelongsToMany { return $this->belongsToMany(Branch::class); } /** * User branches */ public function userBranches(): HasMany { return $this->hasMany(UserBranch::class); } }