i have 3 tableles, i want to make a join query, but i want use if condition to check if the value of input sent in $request from the form if it''s not null i want to add whele contition:
my request is:
$query = DB::table('state')
->join('merchant','state.merchant_id', '=', 'merchant.id')
->join('entity','state.entity_id', '=', 'entity.id')
->where('state.entity_id', '=', 'value of idinput')// to use if condition here
->where('merchant_name, '=', 'value of nameinput')// to use if condition here
->where('entity_color', '=', 'value of colorinput')// to use if condition here
->select('*')
->get();