1 | <?php |
||
13 | class Subscription extends Model implements SubscriptionContact |
||
14 | { |
||
15 | protected $table = 'subscriptions'; |
||
16 | |||
17 | protected $fillable = [ |
||
18 | 'plan_id', 'start_at', 'end_at', |
||
19 | ]; |
||
20 | |||
21 | protected $dates = [ |
||
22 | 'start_at', 'end_at', |
||
23 | ]; |
||
24 | |||
25 | public static function make(PlanContract $plan, Carbon $start_at, Carbon $end_at = null): Model |
||
37 | |||
38 | public function scopeCurrent(Builder $q) |
||
47 | |||
48 | public function getDaysLeft(): ?int |
||
56 | |||
57 | public function isPerpetual(): bool |
||
61 | |||
62 | public function getElapsedDays(): int |
||
66 | |||
67 | public function getExpirationDate(): ?Carbon |
||
71 | |||
72 | public function getStartDate(): Carbon |
||
76 | |||
77 | public function subscriber() |
||
81 | |||
82 | public function plan(): BelongsTo |
||
86 | } |
||
87 |