saeedvaziry / laravel-async

Laravel Async
MIT License
129 stars 9 forks source link

Works from CLI but doesn't work from web #4

Closed immortalsantee closed 9 months ago

immortalsantee commented 9 months ago
class Foo extends Command {
 public function handle(): void
    {
        AsyncHandler::dispatch(static function () {
             SMPushNotification::smSend();
         });
     }
}

php artisan foo works

but

class UserController extends Controller {
   public function index()
    {
       AsyncHandler::dispatch(static function () {
             SMPushNotification::smSend();
         });
    }
}

(new UserController)->index(); doesn't work.

Is there anything i am missing here?

saeedvaziry commented 9 months ago

Looks like a bug!

The reason is, When running with webserver it cannot find the executable PHP.

So we should define the path of the executable in the config files.

Will work on in the weekend.

saeedvaziry commented 9 months ago

Fixed.

You can now update

composer update saeedvaziry/laravel-async

Also check here

https://github.com/saeedvaziry/laravel-async?tab=readme-ov-file#configuration

immortalsantee commented 9 months ago

Thanks @saeedvaziry.