Think that for execute a sp you could use DB::sentence("EXEC dbo.uspMyProcedure(1, 2, 3);").
Hope this helps!
Can anybody help me get stored procedures working right with Laravel / PHP? I'm connecting to a SQL Server database and I've got the procedure mostly working, but I can't get the out parameters to be returned no matter what I try. Below is what I have working at the moment. The procedure runs properly, but the $resultId and $wasTableUpdated variables remain set to 0 instead of updating with the out parameters from the procedure. Any help would be greatly appreciated.
$trainingRecordId = 5318852;
$score = 86;
$completionDate = '10/31/2014';
$db = DB::connection('vision');
$returnId = 0;
$wasTableUpdated = 0;
$stmt = $db->getPdo()->prepare("EXEC dbo.prUpdatePostScoreAndCompDate ?, ?, ?, ?, ?");
$stmt->bindParam(1, $trainingRecordId);
$stmt->bindParam(2, $score);
$stmt->bindParam(3, $completionDate);
$stmt->bindParam(4, $returnId, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT);
$stmt->bindParam(5, $wasTableUpdated, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT);
echo $returnId . "\n";
$stmt->execute();
echo $returnId;
Please or to participate in this conversation.