Advertisement — Top

Responsive Advertisement

Laravel if else condition in query in Coderfunda

 <?php 



// 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);
}

?>

Post a Comment

0 Comments