*/ public function phone(): HasOne { return $this->hasOne(Phone::class); } /** * @psalm-return BelongsToMany */ public function roles(): BelongsToMany { return $this->belongsToMany(Role::class); } /** * @psalm-return HasManyThrough */ public function carsAtMechanic(): HasManyThrough { return $this->hasManyThrough(Mechanic::class, Car::class); } /** * Get the user's image. */ public function image() { return $this->morphOne(Image::Class, 'imageable'); } /** * Scope a query to only include active users. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeActive($query) { return $query->where('active', 1); } }