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) |
||
46 | |||
47 | public function getDaysLeft(): ?int |
||
55 | |||
56 | public function isPerpetual(): bool |
||
60 | |||
61 | public function getElapsedDays(): int |
||
65 | |||
66 | public function getExpirationDate(): ?Carbon |
||
70 | |||
71 | public function getStartDate(): Carbon |
||
75 | |||
76 | public function subscriber() |
||
80 | |||
81 | public function plan(): BelongsTo |
||
85 | } |
||
86 |