54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Lib\ArcadiaLinkUtilities;
|
|
use App\Models\ArcadiaLink;
|
|
use App\Models\Media;
|
|
use Illuminate\Console\Command;
|
|
|
|
class ResendArcadiaLinkMedias extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'medias:resend-aracadia-links';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Resend files to Arcadia after Arcadia Link fix';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function handle()
|
|
{
|
|
// FIXME : Variabiliser la date
|
|
//$al = ArcadiaLink::where('created_at', '>=', '2025-10-23')->get();
|
|
|
|
foreach ($al as $error)
|
|
{
|
|
$media = Media::withTrashed()->find($error->media_id);
|
|
|
|
if ($error->arcadia_id === 0) {
|
|
|
|
ArcadiaLinkUtilities::create($media);
|
|
} else {
|
|
if (is_null($media->deleted_at)) {
|
|
ArcadiaLinkUtilities::update($media);
|
|
} else {
|
|
ArcadiaLinkUtilities::delete($media);
|
|
}
|
|
}
|
|
}
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
}
|