mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
deactivate bookcases
This commit is contained in:
@@ -29,10 +29,10 @@ class SyncOpenBooks extends Command
|
|||||||
$response = Http::post('https://openbookcase.de/api/listarea/83.08995477111446/-200.56640625000003/-38.13455657705413/221.30859375000003');
|
$response = Http::post('https://openbookcase.de/api/listarea/83.08995477111446/-200.56640625000003/-38.13455657705413/221.30859375000003');
|
||||||
|
|
||||||
$ids = collect($response->json()['cases'])->pluck('id');
|
$ids = collect($response->json()['cases'])->pluck('id');
|
||||||
|
try {
|
||||||
|
|
||||||
foreach ($response->json()['cases'] as $case) {
|
foreach ($response->json()['cases'] as $case) {
|
||||||
try {
|
BookCase::withoutGlobalScopes()->updateOrCreate(
|
||||||
BookCase::updateOrCreate(
|
|
||||||
[
|
[
|
||||||
'id' => $case['id'],
|
'id' => $case['id'],
|
||||||
],
|
],
|
||||||
@@ -56,15 +56,15 @@ class SyncOpenBooks extends Command
|
|||||||
'created_by' => 1,
|
'created_by' => 1,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} catch (\Exception $e) {
|
|
||||||
$this->error($e->getMessage());
|
|
||||||
}
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
return Command::SUCCESS;
|
dd($case);
|
||||||
}
|
}
|
||||||
|
|
||||||
BookCase::query()
|
BookCase::query()
|
||||||
->whereNotIn('id', $ids->toArray())
|
->whereNotIn('id', $ids->toArray())
|
||||||
->update(['deactivated' => true]);
|
->update(['deactivated' => true]);
|
||||||
|
|
||||||
|
return Command::SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user