laravel-scout-tntsearch-driver icon indicating copy to clipboard operation
laravel-scout-tntsearch-driver copied to clipboard

Problem with join query

Open d4rkr3pt0r opened this issue 6 years ago • 0 comments

Hi, I have 3 tables with the following structure :

posts (Post Model -> belongsToMany('App\Category')):
id     title    body
--------------------------
categories (Category Model -> belongsToMany('App\Post')):
id     title
--------------------------
category_post
category_id     post_id

My question is how can I write a query to search using multiple inputs? for example I wanna search for a post with the title of "Hello world" which belongs to categories with ids of (1 and 2).

Any help would be greatly appreciated

d4rkr3pt0r avatar Dec 03 '18 02:12 d4rkr3pt0r