use App\PdfFile;
use Fluidbook\ToolboxApiClient\Client;
use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Cache;
class ConvertArchivesToFluidbook extends Command
{
$client = new Client(config('fluidbook.api_token'));
/** @var PdfFile $pdf */
foreach (PdfFile::all() as $pdf) {
+ $cacheKey = "fluidbook_done_{$pdf->slug}";
+ if (Cache::has($cacheKey)) {
+ continue;
+ }
$fluidbook = $client->getFluidbookByReference($pdf->slug);
if ($fluidbook) {
+ Cache::forever($cacheKey, true);
continue;
}
$path = \Storage::disk('local')->path($pdf->pdfPath);
$pdf->slug,
['reference' => $pdf->slug]
);
+ Cache::forever($cacheKey, true);
return;
}
}