xxxxxxxxxx
<?php
// Assuming you are in the root directory of your Laravel project
// Include the necessary bootstrap file
require __DIR__.'/vendor/autoload.php';
// Create an instance of the Artisan console application
$app = require_once __DIR__.'/bootstrap/app.php';
$app->useEnvironmentPath(__DIR__);
// Set the application base path
$app->bind('path.base', function() {
return __DIR__;
});
// Run the "migrate:down" command
$status = \Illuminate\Support\Facades\Artisan::call('migrate:down');
// Check the command's output/status if necessary
$output = \Illuminate\Support\Facades\Artisan::output();
// Display the command's output/status
echo $output;
xxxxxxxxxx
//Rolling Back Migrations
//To roll back the latest migration operation
php artisan migrate:rollback
//You may roll back a limited number of migrations
php artisan migrate:rollback --step=2
//The migrate:reset command will roll back all of your application's migrations:
php artisan migrate:reset