MyriadOrderPackage::title()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace MyriadDataStore\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\BelongsTo;
7
8
/**
9
 * @property \JsonFieldCast\Json\SimpleJsonField $details
10
 */
11
class MyriadOrderPackage extends Model
12
{
13
    protected $guarded = [];
14
15
    protected $casts = [
16
        'details' => \JsonFieldCast\Casts\SimpleJsonField::class,
17
    ];
18
19 3
    public function getTable(): string
20
    {
21 3
        return config('myriad-data-store.tables.order_packages');
22
    }
23
24
    public function getNameAttribute(): string
25
    {
26
        return "Package for order {$this->order_id}";
0 ignored issues
show
Bug introduced by
The property order_id does not exist on MyriadDataStore\Models\MyriadOrderPackage. Did you mean order?
Loading history...
27
    }
28
29
    public function order(): BelongsTo
30
    {
31
        return $this->belongsTo(MyriadOrder::class, 'order_id', 'id');
32
    }
33
34
    public function title(): BelongsTo
35
    {
36
        return $this->belongsTo(MyriadTitle::class, 'title_id', 'id');
37
    }
38
39
    public function type(): BelongsTo
40
    {
41
        return $this->belongsTo(MyriadOrderPackageType::class, 'order_package_type_id', 'id');
42
    }
43
}
44