Completed
Push — dev ( 4f11ce...5d65d1 )
by Alies
06:00 queued 01:47
created

Subscription   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 16
c 0
b 0
f 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A campaign() 0 3 1
A donator() 0 3 1
1
<?php
2
3
namespace Diglabby\Doika\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\BelongsTo;
7
8
/**
9
 * @property int $id
10
 * @property int $donator_id
11
 * @property string $payment_gateway ("bePaid", etc)
12
 * @property string $payment_gateway_subscription_id
13
 * @property int $amount
14
 * @property string $currency
15
 * @property string $payment_interval (Time interval in ISO 8601, "P1M" by default)
16
 * @property Carbon $created_at
17
 * @property Carbon $updated_at
18
 *
19
 * Relationships:
20
 * @property-read Donator $donator
21
 * @property-read Campaign $campaign
22
 */
23
final class Subscription extends Model
24
{
25
    /** @var array Default attributes */
26
    protected $attributes = [
27
        'currency' => 'BYN',
28
        'payment_interval' => 'P1M', // means "Period: 1 Month"
29
    ];
30
31
    public function donator(): BelongsTo
32
    {
33
        return $this->belongsTo(Donator::class);
34
    }
35
36
    public function campaign(): BelongsTo
37
    {
38
        return $this->belongsTo(Campaign::class);
39
    }
40
}
41