Relation de données de recherche Laravel
$data = Subcategory::with(["category"])
->where('name','like', '%'.$this->searchData.'%')
->orWhereHas('category', function($query){$query->where('name', 'like', '%'.$this->searchData.'%');})
->orderBy($this->orderByData, $this->orderByAsc ? 'asc' : 'desc')
->paginate($this->showData);
hirohito