11 lines
974 B
PHP
11 lines
974 B
PHP
<?php
|
|
namespace App\Console\Commands;
|
|
use App\Models\LicenseProduct;
|
|
use Illuminate\Console\Command;
|
|
class RsyncStudioProductCreate extends Command
|
|
{
|
|
protected $signature='rsync-studio:product {code} {--name=Rsync Studio} {--edition=Professional} {--activations=1} {--max-major=1} {--provider=} {--product-id=} {--price-id=}';
|
|
protected $description='Create or update a Rsync Studio licensing product';
|
|
public function handle(): int { $p=LicenseProduct::updateOrCreate(['code'=>$this->argument('code')],['name'=>$this->option('name'),'edition'=>$this->option('edition'),'activation_limit'=>(int)$this->option('activations'),'max_major_version'=>$this->option('max-major')!==''?(int)$this->option('max-major'):null,'payment_provider'=>$this->option('provider')?:null,'external_product_id'=>$this->option('product-id')?:null,'external_price_id'=>$this->option('price-id')?:null,'active'=>true]); $this->info("Product {$p->code} ready."); return self::SUCCESS; }
|
|
}
|