$comments * @property-read int|null $comments_count * @property-read \Illuminate\Database\Eloquent\Collection $deals * @property-read int|null $deals_count * @property-read \Illuminate\Database\Eloquent\Collection $dealsInteractions * @property-read int|null $deals_interactions_count * @property-read \Illuminate\Database\Eloquent\Collection $inboxes * @property-read int|null $inboxes_count * @property-read \Illuminate\Database\Eloquent\Collection $interactedDeals * @property-read int|null $interacted_deals_count * @property-read \Illuminate\Database\Eloquent\Collection $interactions * @property-read int|null $interactions_count * @property-read \Illuminate\Database\Eloquent\Collection $messages * @property-read int|null $messages_count * @property-read \Illuminate\Notifications\DatabaseNotificationCollection $notifications * @property-read int|null $notifications_count * @property-read \Illuminate\Database\Eloquent\Collection $pushSubscriptions * @property-read int|null $push_subscriptions_count * @property-read \Illuminate\Database\Eloquent\Collection $recentSearches * @property-read int|null $recent_searches_count * @property-read \Illuminate\Database\Eloquent\Collection $reports * @property-read int|null $reports_count * @property-read Model|\Eloquent|null $type * @method static \Database\Factories\UserFactory factory($count = null, $state = []) * @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|User newQuery() * @method static \Illuminate\Database\Eloquent\Builder|User query() * @method static \Illuminate\Database\Eloquent\Builder|User whereCreatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereEmail($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereEmailVerifiedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereName($value) * @method static \Illuminate\Database\Eloquent\Builder|User wherePassword($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereRememberToken($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereRole($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereRoleId($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereRoleType($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereStatus($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereUpdatedAt($value) * @mixin \Eloquent */ class User extends Authenticatable { /** @use HasFactory<\Database\Factories\UserFactory> */ use HasFactory, HasPushSubscriptions, Notifiable; /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ 'name', 'email', 'password', 'status', 'role', ]; /** * The attributes that should be hidden for serialization. * * @var list */ protected $hidden = [ 'password', 'remember_token', ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } public function isBroker(): bool { return $this->type instanceof Broker; } public function isAdmin(): bool { return $this->type instanceof Admin; } public function isCustomer(): bool { return $this->type instanceof Customer; } public function deals(): HasMany { return $this->hasMany(Deal::class); } /** * Returns model of User's role type */ public function type(): MorphTo { return $this->morphTo('role'); } public function interactions(): HasMany { return $this->hasMany(User::class); } public function recentSearches(): HasMany { return $this->hasMany(RecentSearch::class); } public function dealsInteractions(): HasManyThrough { return $this->hasManyThrough(Interaction::class, Deal::class); } public function interactedDeals(): HasManyThrough { return $this->hasManyThrough(Deal::class, Interaction::class, 'user_id', 'id', 'id', 'deal_id'); } public function reports(): HasMany { return $this->hasMany(Report::class); } public function comments(): HasMany { return $this->hasMany(Comment::class); } public function inboxes(): BelongsToMany { return $this->belongsToMany(Inbox::class); } public function messages(): HasMany { return $this->hasMany(Message::class); } }