saeedvaziry / laravel-async

Laravel Async
MIT License
129 stars 9 forks source link

Request $request can not be pass it as variable #1

Open manunoly opened 11 months ago

manunoly commented 11 months ago

Hello @saeedvaziry nice package, this can be the missing piece that PHP is needing,

if I pass any variable is working fine AsyncHandler::dispatch(function () use ($user) { logger('test'); });

but if you pass the $request object to AsyncHandler::dispatch fn, I always get a 500 error, it's the expected behave or I'm missing something,

AsyncHandler::dispatch(function () use ($request) { logger('test'); }); image

saeedvaziry commented 11 months ago

I can confirm this bug. will take a look at it.

but as a workaround I was able to use request() helper inside the closure.

badarnento commented 3 months ago

Hi @saeedvaziry

Did you manage to resolve this issue? I’m currently encountering the same problem that @manunoly mentioned. You mentioned that you were able to use the request() helper. I tried it, but I’m still unable to resolve the issue.