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

kenprogrammer's avatar

Determine if database migration has completed successfully

If I run migration outside of CLI as shown on the snippet below:

Route::get('/migrate',function(){
    \Artisan::call('migrate');
});

How can I determine if the migration has completed successfully? Hint: Similar to Laravel 7 error message which gives an option to run migration if table or column not found.

I need this for a project on shared hosting.

0 likes
2 replies
bobbybouwmann's avatar
Level 88

You get the exit code of the command back. If this is 1 it failed. If it's 0it's successful

$exitCode = Artisan::call('migrate');
1 like

Please or to participate in this conversation.