Relacionamento de dados de pesquisa de 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