Deploy Ladill Woo Manager / deploy (push) Successful in 51s
Free: 1 store and 20 products. Pro/Business mirrors Invoice pricing (GHS 49/149) with wallet renewals, Paystack prepay, session-based store switcher, and scoped UI. Co-authored-by: Cursor <cursoragent@cursor.com>
50 lines
1.2 KiB
PHP
50 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Woo;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ProSubscription extends Model
|
|
{
|
|
public const STATUS_ACTIVE = 'active';
|
|
|
|
public const STATUS_CANCELED = 'canceled';
|
|
|
|
public const STATUS_PAST_DUE = 'past_due';
|
|
|
|
public const PLAN_PRO = 'pro';
|
|
|
|
public const PLAN_ENTERPRISE = 'enterprise';
|
|
|
|
protected $table = 'woo_pro_subscriptions';
|
|
|
|
protected $fillable = [
|
|
'user_id', 'status', 'plan', 'price_minor', 'currency', 'auto_renew',
|
|
'started_at', 'current_period_end', 'last_charged_at', 'canceled_at',
|
|
'last_reference', 'last_error',
|
|
];
|
|
|
|
protected $casts = [
|
|
'auto_renew' => 'boolean',
|
|
'price_minor' => 'integer',
|
|
'started_at' => 'datetime',
|
|
'current_period_end' => 'datetime',
|
|
'last_charged_at' => 'datetime',
|
|
'canceled_at' => 'datetime',
|
|
];
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function entitled(): bool
|
|
{
|
|
return $this->status !== self::STATUS_PAST_DUE
|
|
&& $this->current_period_end !== null
|
|
&& $this->current_period_end->isFuture();
|
|
}
|
|
}
|