I tend to just do it as you would in native PHP: http://stackoverflow.com/questions/22517903/using-a-stored-procedure-in-laravel-4
On some projects I have abstracted it into it's own class to make it more concise (automatically sets the database to use, gives a better way to access the return value).
I would certainly advise putting your stored procedures in a repository, it makes it easier to manage in the long term. https://laracasts.com/search?q=repository
I have a proble related to this issue
If I do:
$st = \DB::select( "DECLARE @liResult INT, @lsMsg VARCHAR(200); EXEC ONW_SP_CANCELA_EMP '000016', @liResult, @lsMsg OUTPUT; SELECT @liResult as result, @lsMsg as msg;" );
dd($st);
I get:
[]
But if I do this (comment out the exec to SP):
$st = \DB::select( "DECLARE @liResult INT, @lsMsg VARCHAR(200); -- EXEC ONW_SP_CANCELA_EMP '000016', @liResult, @lsMsg OUTPUT; SELECT @liResult as result, @lsMsg as msg;" );
dd($st);
I get this:
array:1 [▼ 0 => {#333 ▼ +"result": null +"msg": null } ]
An if I execute in the rdms console I do get the select correctly, do you know a work around for this?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community