model query in laravel with if and else code example
Example: laravel if else condition in query
$query = SocialMediaFeed::where('location_id', $location_id);
if(!$filters) {
$query = $query->where('self', '<>', true);
} else {
$query = $query->orWhere('self', true);
}