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

Subscription::campaign()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
nc 1
nop 0
dl 0
loc 3
c 0
b 0
f 0
cc 1
rs 10
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