📅  最后修改于: 2022-03-11 14:54:50.993000             🧑  作者: Mango
$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);