belongsTo(User::class); } public function rank() { return $this->hasOne(Rank::class, 'id', 'rank_id'); } public function scopeType($query, $type) { return $query->where('type', $type); } }