There is no standard procedure mentioned in documentation that how to call a stored procedure in MYSQL in laravel with Eloquent syntax.
I mean is there any way to call stored procedure in mysql with help of eloquent syntax like
$result = StoredProcedures::my_custom_procedure(param1, param2);
return view('welcome')->with('result',$result);
Is there any way to call and fetch results from stored procedures with pure eloquent syntax(purely eloquent way).
Thanks. Small examples are highly encouraged .
As everyone has mentioned, you can't call a stored procedure in Laravel with Eloquent syntax. You can transfer the result of your query to a collection which will give you all of the collection functionality.
$queryResult = DB::select('call my_custom_procedure(?, ?)', [1,2]);
$result = collect($queryResult);
return view('welcome')->with('result',$result);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With