actually i am working on some maintenance project where previous developer used core sql query but i want to convert in to larvel query.. Here is Sql query :-
$directories = DB::select('
SELECT d.id, d.name, d.url_match, d.login_url, d.register_url, d.notes, d.logo, d.require_verification FROM `directories` d
WHERE d.id
NOT IN (
SELECT c.directory_id FROM citations c
INNER JOIN directories d
WHERE c.directory_id = d.id
AND d.allow_citation = 1
AND c.site_id = ' . $siteID .'
)
AND d.allow_citation = 1
AND d.deleted_at IS NULL
AND d.tier = '. $tier .'
ORDER BY d.tier ASC
');
I have tried to convert in laravel below:-
$directories = Directories::select('id','name','url_match','login_url','register_url','notes',
'logo','require_verification')
->where(['allow_citation'=>1,'tier'=>$tier])
->whereNUll('deleted_at')->get();
Can someone help me. Thanks in advance