where('type', 'client'); } public function scopeOfName($query, $name) { return $query->where('fieldname', 'LIKE', "{$name}|%"); } public function customFieldValue() { return $this->hasMany(CustomFieldValue::class,"fieldid"); } }