Answers for "search data relationship eloquent laravel"

PHP
1

laravel search data relationship

$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);
Posted by: Guest on September-28-2021

Code answers related to "search data relationship eloquent laravel"

Browse Popular Code Answers by Language