Merge branch 'trunk'
This commit is contained in:
commit
1fd8f3bd35
2 changed files with 57 additions and 0 deletions
56
app/Console/Commands/RegenBRBase.php
Normal file
56
app/Console/Commands/RegenBRBase.php
Normal 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue