-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathArchiveData.php
46 lines (40 loc) · 1.01 KB
/
ArchiveData.php
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
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace App\Console\Commands;
use App\Jobs\ArchiveProject;
use App\Jobs\ArchiveStudy;
use App\Models\Project;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class ArchiveData extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'nmrxiv:archive-data';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle(): void
{
DB::transaction(function () {
$projects = Project::where([
['is_public', true],
['download_url', null],
])->get();
foreach ($projects as $project) {
echo $project->identifier;
echo "\r\n";
ArchiveProject::dispatch($project);
ArchiveStudy::dispatch($project);
}
});
}
}