MyriadOrderPackage   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 20%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 31
ccs 2
cts 10
cp 0.2
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A order() 0 3 1
A type() 0 3 1
A getTable() 0 3 1
A getNameAttribute() 0 3 1
A title() 0 3 1
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