where('type', $type); } function user() { return $this->hasOne(User::class, 'id', 'user_id'); } }