i have a query like this:
$sql = Trip::select('*')
->from('trips as t')
->join('trip_types as tt', 'tt.id', '=', 't.trip_type')
->leftJoin('seo_table as s', 's.ref_id', '=', 't.id')
->where('t.id', '=', $id)
->where('s.ref_id', '=', 'trip') <!--this statement should only run is seo_table has data-->
->get()->first();
i want {where('s.ref_id','=','trip')} to execute only if there is data on "seo_table"
how can this be done?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community