lorisleiva / laravel-actions

⚡️ Laravel components that take care of one specific task
https://laravelactions.com
MIT License
2.52k stars 124 forks source link

Class "Illuminate\Foundation\Bus\PendingDispatch" not found #126

Closed jgarivera closed 3 years ago

jgarivera commented 3 years ago

Good day👋! I acknowledge that this package does not officially state its support for Laravel Lumen, but I decided to give it a try. I am using laravel/lumen-framework v8.0 with laravel-actions v2.1 and I am encountering this error:

image

Observingly, Lumen does not have the Illuminate\Foundation\Bus\PendingDispatch class. Lumen's counterpart for that class is Laravel\Lumen\Bus\PendingDispatch.

My current workaround for this issue is using Lumen's dispatch helper like so: dispatch(TestAction::makeJob()). But I would like to have Lumen support for the elegant TestAction::dispatch() methods. Thank you!

lorisleiva commented 3 years ago

Hi there 👋

Thanks for raising this issue, since I never use Lumen I'm never 100% sure of how well this package supports it.

I'm more than happy to accept a PR that fixes this. At the top of my head the changes — in the AsJob trait — should just be:

lorisleiva commented 3 years ago

Hi there 👋

I actually tried to implement this and it turned out to be a lot more tricky than expected. Mostly because there isn't a common interface of PendingDispatch that overlaps Laravel and Lumen.

Since this issue doesn't seem to have much traction, I'm going to close this for housekeeping but if anyone wants to improve Laravel Actions' compatibility with Lumen, I'm more than happy to accept a PR for this.

Thank you for your understanding. 🌷