Files
ladill-woo-manager/app/Models/Woo/ProSubscription.php
T
isaaccladandCursor cfdc8c7c09
Deploy Ladill Woo Manager / deploy (push) Successful in 2m11s
Add Woo Manager email notification milestones with shared mail templates.
New order, store connected, Pro expiry, and past-due alerts use the Ladill notification layout with woo branding; expiry reminders dedupe per threshold like hosting.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 02:59:45 +00:00

51 lines
1.3 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', 'metadata',
];
protected $casts = [
'auto_renew' => 'boolean',
'price_minor' => 'integer',
'started_at' => 'datetime',
'current_period_end' => 'datetime',
'last_charged_at' => 'datetime',
'canceled_at' => 'datetime',
'metadata' => 'array',
];
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();
}
}