php - Get all the values in the table if parameter is null -
products::active($userid) ->where('name','like','%'.input::get('search').'%') ->orderby('created_at', 'desc') ->with('color') ->wherehas('seasons', function ($query)use($seasons) { $query->wherein('season_id', $seasons); });
in above query want results if $seasons
null. in sql can write where($seasons
null) or (season_id
in $season
). how can write in laravel. wherehas makes inner join. products have atleast 1 season come. how can make left join products come if season null?
Comments
Post a Comment