I'm working with transactions in laravel 5, so far I have been getting the results of any method outside of the statement with a reference param &$, but I red this is a bad practice because the operator "&" is obsolete. Is there any other way to get the value of a var outside transaction scope?
this is a code example:
public function post(Request $request, Persona $persona)
{
try {
DB::transaction(function () use ($request, &$result) {
$result = Persona::create($request->all());
// ... Moooore code omitted
});
// Do more thing with $result
$result;
} // ...
}}