Merge branch 'trunk'

This commit is contained in:
Vincent BRIDIER 2025-11-13 09:36:15 +01:00
commit 1fd8f3bd35
2 changed files with 57 additions and 0 deletions

View file

@ -0,0 +1,56 @@
<?php
namespace App\Console\Commands;
use App\Models\Coupon;
use App\Traits\GenerateBR;
use Illuminate\Console\Command;
use Illuminate\Http\Request;
class RegenBRBase extends Command
{
use GenerateBR;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'coupons:regen-base';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Re-generate coupons base image';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$publishedCoupons = Coupon::where('coupon_published', 1)->get();
foreach ($publishedCoupons as $coupon)
{
$br_path = $this->generateBase(new Request(), $coupon);
$coupon->coupon_image = $br_path;
$coupon->save();
}
return 0;
}
}

View file

@ -27,6 +27,7 @@ class Kernel extends ConsoleKernel
protected $commands = [
\App\Console\Commands\CustomersClaims::class,
\App\Console\Commands\ArchiveStatsCommand::class,
\App\Console\Commands\RegenBRBase::class,
];
/**