vuongxuongminh / laravel-async

Package provide simple way to run code asynchronously for your Laravel application.
MIT License
154 stars 26 forks source link

Non-static method 'run' should not be called statically error #21

Closed saulob closed 1 year ago

saulob commented 3 years ago

I'm unable to execute the first code from the readme, it says that I cannot execute the run method

Check the screenshot above

image

I'm using Laravel 8 and PHP 7

vuongxuongminh commented 3 years ago

Have you import Async fadecade?

<?php

use Async;
saulob commented 3 years ago

Yeah, did that, did the publish config, everything.

And still same error.

vuongxuongminh commented 3 years ago

Look like you are using VXM\Async\Async, could you show me first few lines of your PHP file?

CheeseTastisch commented 3 years ago

Same issue for me. I included use Async, but it didn't fine the Async class. Have you found a solution @saulob?

saulob commented 2 years ago

Sorry @CheeseTastisch, no luck here. I removed it, stopped using it :(

CheeseTastisch commented 2 years ago

Hey @saulob. For me it worked fine, as i installed the ide-helper package and execute the command php artisan ide:helper:generate. I hope this can fix it for you as well.

parsasi commented 2 years ago

I was able to register it manually (since it was being registered automatically):

$app->register(VXM\Async\AsyncServiceProvider::class);

That resolved this issue, only to throw another error Call to undefined function VXM\\Asyn= c\\config_path(). I can't think of a way where registering it like that would cause this error.

lukasmedia commented 2 years ago

Any updates on this issue?

CheeseTastisch commented 2 years ago

@parsasi @lukasmedia As i said in the answer before, it's working perfect, if you install ide-helper and run php artisan ide-helper:generate.

Than import the Async Trait (not use VXM\Async\Async but use Async).

ramanaptr commented 2 years ago

Hi @vuongxuongminh this is my code already implemented and followed your documentation step by step, but I experienced some errors at code editor.

Are you able to guide me, please? on how to use the function with use Async

Screenshot:

Screen Shot 2022-08-27 at 5 39 28 PM
vuongxuongminh commented 1 year ago

Use VXM\Async\AsyncFacade as Async; instead.