Deployer [Error] Call to undefined function Deployer\artisan()

494 Views Asked by At

When I try to call the artisan function from within a closure in the deploy.php and I run into this error:

[Error] Call to undefined function Deployer\artisan()

My deploy.php looks like this:

<?php declare(strict_types=1);

namespace Deployer;

require 'recipe/laravel.php';
require 'recipe/rsync.php';

// ...

$migrateClosure = function () {
        artisan('migrate:fresh --force')();
    };

// ...

task('migrate', $migrateClosure);

$deployTasks = [];
$deployTasks[] = 'deploy:info';
$deployTasks[] = 'deploy:prepare';
$deployTasks[] = 'deploy:lock';
$deployTasks[] = 'deploy:release';
$deployTasks[] = 'rsync'; // Deploy code & built assets
$deployTasks[] = 'deploy:secrets';
$deployTasks[] = 'deploy:shared';
$deployTasks[] = 'deploy:vendors';
$deployTasks[] = 'deploy:writable';
$deployTasks[] = 'artisan:storage:link';
$deployTasks[] = 'artisan:view:cache';
$deployTasks[] = 'artisan:config:cache';
$deployTasks[] = 'artisan:optimize';
$deployTasks[] = 'migrate';
$deployTasks[] = 'deploy:symlink';
$deployTasks[] = 'deploy:unlock';
$deployTasks[] = 'cleanup';
task('deploy', $deployTasks);

Question is; how is possible (if possible at all) to call the artisan function declared in the recipe/laravel.php?

0

There are 0 best solutions below