Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

joshpsawyer's avatar

artisan command works via CLI, not via Artisan facade

Hi all,

I've got an artisan command that calculates QOH for kits based on the components for supplier X. This command works when run via the command line, and when I run php artisan the command shows in the list of available commands.

I've made an event handler to add this command to my queue when a SupplierXUpdated event is fired. The handler is catching the event correctly -- debugged with dd(). However this code:

    public function handle(CanadianInventoryWasUpdated $event)
    {
        Artisan::queue("seom:calculatecanadiankits");
    }

results in this error:

production.ERROR: exception 'InvalidArgumentException' with message 'There are no commands defined in the "seom" namespace.' in /home/joshs/php_projects/webse     rvices2/vendor/symfony/console/Symfony/Component/Console/Application.php:501

I've tried composer dump-autoload and artisan optimize. I'm on Laravel 5.0.35 (I know, I know)

I'm able to use Artisan::queue() in other files without issue, and even in a different event handler. I can't figure out why this one's giving me an issue.

0 likes
1 reply
sboj2scz's avatar

Does queueing of system (Laravel built-in) commands work?

Please or to participate in this conversation.