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

copyandpaste's avatar

Laravel Envoy run a command for each task

So as what the title have said..

examples..

@task('deploy_staging')
        cd {{ $project_directory }}
	git pull
@endtask

@task('deploy_project')
        cd {{ $project_directory }}
	git pull
@endtask

@task('clear_all_types_of_cache')
        cd {{ $project_directory }}
        php artisan cache:clear
        php artisan view:clear
        php artisan route:clear
        php artisan clear
@endtask

@task('migrate_database')
        cd {{ $project_directory }}
        php artisan migrate --force
@endtask

you get the idea..

what I wanted is to move the command cd {{ $project_directory }} so the task commands are clean and concise, migrate database task should not care how to cd into project directory..

don't limit my question to the Change Directory Command, this could be usefull on some other commands also.

0 likes
0 replies

Please or to participate in this conversation.