Thursday, 12 September 2013

Using Laravel DB object to run postgresql functions with input parameters

Using Laravel DB object to run postgresql functions with input parameters

I have some postgresql functions that I run in the form:
SELECT * FROM pgfunction(1,2,3);
This enables me to filter / order / group the results:
SELECT * FROM pgfunction(1,2,3) WHERE value > 10;
How could I pass the parameters to the postgresql function in laravel
using prepared statements in order to filter the results in laravel.
Example:
DB:RAW('pgfunction',array(1,2,3))->where('value','>','10');
Is this possible?

No comments:

Post a Comment