@smalldreams If you have a proper relationship, you can achieve this:
$products = Product::whereHas('category', function ($query) {
$query->where('name', 'like', '%' . $this->searchCategory . '%'); //Assuming the category's field you're searching by is named 'name'
})->latest()->paginate($this->perPage);