domain_name,$this->tld->name)); } /* RELATIONS */ public function tld() { return $this->belongsTo(TLD::class); } /* SCOPES */ /** * Search for a record * * @param $query * @param string $term * @return mixed */ public function scopeSearch($query,string $term) { // If we have a period in the name, we'll ignore everything after it. $term = strstr($term,'.',TRUE) ?: $term; // Build our where clause return parent::scopeSearch($query,$term) ->orwhere('domain_name','like','%'.$term.'%'); } }