src/Console/Commands/RollbackCommand.php
<?php
declare(strict_types=1);
namespace Cortex\Attributes\Console\Commands;
use Rinvex\Attributes\Console\Commands\RollbackCommand as BaseRollbackCommand;
class RollbackCommand extends BaseRollbackCommand
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cortex:rollback:attributes {--f|force : Force the operation to run when in production.}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Rollback Cortex Attributes Tables.';
/**
* Execute the console command.
*
* @return void
*/
public function handle(): void
{
$path = config('cortex.attributes.autoload_migrations') ?
'app/cortex/attributes/database/migrations' :
'database/migrations/cortex/attributes';
if (file_exists($path)) {
$this->call('migrate:reset', [
'--path' => $path,
'--force' => $this->option('force'),
]);
} else {
$this->warn('No migrations found! Consider publish them first: <fg=green>php artisan cortex:publish:attributes</>');
}
parent::handle();
}
}