Skip to content

Commit

Permalink
Jobs install command
Browse files Browse the repository at this point in the history
  • Loading branch information
mooxbot committed Dec 8, 2023
1 parent 7eaedf3 commit aa6047d
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace Moox\Jobs\Commands;

use Illuminate\Console\Command;

class InstallCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'mooxjobs:install';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Publish and migrate Moox Jobs Package';

/**
* Execute the console command.
*/
public function handle()
{
$this->comment('Publishing Jobs Configuration...');
$this->callSilent('vendor:publish', ['--tag' => 'jobs-config']);

$this->comment('Publishing Jobs Migrations...');
$this->callSilent('vendor:publish', ['--tag' => 'jobs-migrations']);

if (config('queue.default') === 'database') {
$this->comment('Creating Queue Tables...');
$this->callSilent('queue:table');
$this->callSilent('queue:failed-table');
$this->callSilent('queue:batches-table');
}

if (class_exists('Adrolli\FilamentJobManager\ServiceProvider')) {
$this->comment('Uninstalling adrolli/filament-job-manager package...');
$this->callSilent('composer', ['remove', 'adrolli/filament-job-manager']);
$this->comment('adrolli/filament-job-manager package uninstalled successfully.');
}

$this->call('migrate');
$this->info('Moox Jobs was installed successfully');
}
}

0 comments on commit aa6047d

Please sign in to comment.