#How to filter table?

1 messages · Page 1 of 1 (latest)

fierce furnace
#

I want to filter table using tags
I have connected Tags model to jobs model using belongsToMany and it works it show me posts that have specific tags
but i want to filter jobs with location, type and language how can i do that?
now my code looks like this


Route::get('/jobs/filter/{location}/{language}/{type}',function(){


    $location = $_GET['location'];
    $type = $_GET['type'];
    $language = $_GET['language'];

    $location_tag =  Tag::find($location)->id;  

    $tags = Tag::findMany([$location, $type, $language]);

   


    
     
    // return view('jobs',compact(['jobs']));
 
})->name('filter');

void sierra
#

hi, use whereRelation or whereHas