Skip to content

Commit

Permalink
Update InstallCommand.php
Browse files Browse the repository at this point in the history
  • Loading branch information
mooxbot committed Dec 19, 2023
1 parent 1b54cd3 commit cb5855b
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

use function Laravel\Prompts\alert;
use function Laravel\Prompts\confirm;
use function Laravel\Prompts\error;
use function Laravel\Prompts\info;
use function Laravel\Prompts\multiselect;
use function Laravel\Prompts\note;
use function Laravel\Prompts\warning;

class InstallCommand extends Command
{
Expand Down Expand Up @@ -88,10 +88,6 @@ public function publish_migrations(): void

public function create_queue_tables(): void
{
if (config('queue.default') != 'database') {
error('Your queue driver should be set to database, to use all features of Moox Jobs.');
}

if ($createQueueTables = confirm('Do you wish to create the queue tables?', true)) {
note('Your Jobs are using the database queue driver. Creating Queue Tables...');

Expand Down Expand Up @@ -130,6 +126,12 @@ public function register_plugins(): void
{
note('Registering the Filament Resources...');

$queueDriver = '';

if (config('queue.default') == 'database') {
$queueDriver = 'database';
}

$providerPath = app_path('Providers/Filament/AdminPanelProvider.php');

if (File::exists($providerPath)) {
Expand All @@ -140,11 +142,21 @@ public function register_plugins(): void

$namespace = "\Moox\Jobs";

$pluginsToAdd = multiselect(
label: 'These plugins will be installed:',
options: ['JobsPlugin', 'JobsWaitingPlugin', 'JobsFailedPlugin', 'JobsBatchesPlugin'],
default: ['JobsPlugin', 'JobsWaitingPlugin', 'JobsFailedPlugin', 'JobsBatchesPlugin'],
);
if ($queueDriver != 'database') {
warning('The queue driver is not set to database. Jobs waiting will not be installed.');

$pluginsToAdd = multiselect(
label: 'These plugins will be installed:',
options: ['JobsPlugin', 'JobsWaitingPlugin', 'JobsFailedPlugin', 'JobsBatchesPlugin'],
default: ['JobsPlugin', 'JobsFailedPlugin', 'JobsBatchesPlugin'],
);
} else {
$pluginsToAdd = multiselect(
label: 'These plugins will be installed:',
options: ['JobsPlugin', 'JobsWaitingPlugin', 'JobsFailedPlugin', 'JobsBatchesPlugin'],
default: ['JobsPlugin', 'JobsWaitingPlugin', 'JobsFailedPlugin', 'JobsBatchesPlugin'],
);
}

$function = '::make(),';

Expand Down

0 comments on commit cb5855b

Please sign in to comment.