Answers for "laravel search data relationship"

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 "laravel search data relationship"

Browse Popular Code Answers by Language