Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #condition #query
ADD COMMENT
Topic
Name
6+5 =