-
-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathSyncPlugins.php
More file actions
35 lines (23 loc) · 789 Bytes
/
SyncPlugins.php
File metadata and controls
35 lines (23 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
namespace App\Console\Commands;
use App\Jobs\SyncPlugin;
use App\Models\Plugin;
use Illuminate\Console\Command;
class SyncPlugins extends Command
{
protected $signature = 'plugins:sync';
protected $description = 'Dispatch jobs to sync all plugins from their repositories';
public function handle(): int
{
$plugins = Plugin::all();
$count = $plugins->count();
if ($count === 0) {
$this->info('No plugins to sync.');
return self::SUCCESS;
}
$this->info("Dispatching sync jobs for {$count} plugins...");
$plugins->each(fn (Plugin $plugin) => dispatch(new SyncPlugin($plugin)));
$this->info('Done. Jobs have been dispatched to the queue.');
return self::SUCCESS;
}
}