Answers for "search with relationships 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 with relationships laravel"

Browse Popular Code Answers by Language