use IFNULL in laravel
replace 

-&gt;select('subjects.subjectID', 'subjects.subjectName', 'subjects.price',  
IFNULL( `downloads`.`is_download` , 0 ) )


with

-&gt;select('subjects.subjectID', 'subjects.subjectName', 'subjects.price',  
DB:Raw(' IFNULL( `downloads`.`is_download` , 0 )') )


and add an alias

-&gt;select('subjects.subjectID', 'subjects.subjectName', 'subjects.price',  
DB:Raw(' IFNULL( `downloads`.`is_download` , 0 ) as is_download') )