Call MySQL stored procedure with OUT parameter in Laravel using prepared statement

This is continuing my last post about How to call a MySQL stored procedure with output parameters. But, In this case We will call the stored procedure using PHP Laravel framework. I assume that We already have the stored procedure in our MySQL database.

I suggest to use prepared statement instead of statement to call MySQL stored procedure. One of the some reasons is protection against SQL Injection. This is how to call MySQL stored procedure in laravel using prepared statement.

$param1 = 12; $param2 = 8; $total = 'total';
DB::statement(DB::raw('CALL itjbg_spsum(?, ?, @)'), 
	array($param1, $param2, $total)
);