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

Pixelairport's avatar

Call Artisan::call() from api route.

Hi, I try to call Artisan::call from api route, but get the error that command does not exist. When I call it via console it exists. Is there a way to do it... maybe by adding a special middleware? At the moment I have


        'api' => [
            // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
            'throttle:api',
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],
0 likes
1 reply
Pixelairport's avatar
Pixelairport
OP
Best Answer
Level 12

Ok... I started to refactor everything. The business-logic was already in actions. I only wrapped the actions with a command to use artisan. So I now use the actions (with a bit refactoring) instead the commands.

Please or to participate in this conversation.