Skip to content

Instantly share code, notes, and snippets.

@Carmageddon
Created March 18, 2015 21:01
Show Gist options
  • Save Carmageddon/3b82d262bd739138dbcc to your computer and use it in GitHub Desktop.
Save Carmageddon/3b82d262bd739138dbcc to your computer and use it in GitHub Desktop.
Raw parametarized query
$results = DB::select( DB::raw('SELECT "Subscription".*
FROM "Subscription"
JOIN "Account" ON "Subscription"."AccountID" = "Account"."AccountID"
JOIN "PayTool" ON "Subscription"."AccountID" = "PayTool"."OwnerAccountID"
JOIN "Plan" ON "Subscription"."PlanID" = "Plan"."PlanID"
WHERE
(
(
("AdminPhNumber" = \':cellnum\' AND "AdminPhAreaCode" = \':CellArea\') OR ("BillPhNumber" = \':cellnum\' AND "BillPhAreaCode" = \':CellArea\') or ("TechPhNumber" = \':cellnum\' AND "TechPhAreaCode" = \'CellArea\') OR ("PersPhNumber" = \':cellnum\' AND "PersPhAreaCode" = \'CellArea\')
OR
("AdminFaxNumber" = \':cellnum\' AND "AdminFaxAreaCode" = \'CellArea\') OR ("BillFaxNumber" = \':cellnum\' AND "BillFaxAreaCode" = \'CellArea\') or ("TechFaxNumber" = \':cellnum\' AND "TechFaxAreaCode" = \'CellArea\') OR ("PersFaxNumber" = \':cellnum\' AND "PersFaxAreaCode" = \'CellArea\')
)
OR ("PayTool"."CutNumber" LIKE \'%:CCLast4Digits\' AND "Account"."TaxRegID" = \':TaxRegID\')
)
AND "Plan"."serviceTemplateID" IN (181, 228, 237)
AND "Subscription"."Status" = 30'), array(
'cellnum' => '4578568',
'CellArea' => '54',
'CCLast4Digits' => '1234',
'TaxRegID' => '123456789'
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment