CharacterInventory::reference()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php namespace FreedomCore\TrinityCore\Character\Models;
2
3
use FreedomCore\TrinityCore\Character\Models\CharacterBaseModel;
4
5
/**
6
 * Class CharacterInventory
7
 *
8
 * @package FreedomCore\TrinityCore\Character\Models
9
 * @property int $guid Global Unique Identifier
10
 * @property int $bag
11
 * @property int $slot
12
 * @property int $item Item Global Unique Identifier
13
 * @property-read \FreedomCore\TrinityCore\Character\Models\ItemInstance $reference
14
 * @method static \Illuminate\Database\Eloquent\Builder|\FreedomCore\TrinityCore\Character\Models\CharacterBaseModel incrementID()
15
 * @method static \Illuminate\Database\Eloquent\Builder|\FreedomCore\TrinityCore\Character\Models\CharacterInventory whereBag($value)
16
 * @method static \Illuminate\Database\Eloquent\Builder|\FreedomCore\TrinityCore\Character\Models\CharacterInventory whereGuid($value)
17
 * @method static \Illuminate\Database\Eloquent\Builder|\FreedomCore\TrinityCore\Character\Models\CharacterInventory whereItem($value)
18
 * @method static \Illuminate\Database\Eloquent\Builder|\FreedomCore\TrinityCore\Character\Models\CharacterInventory whereSlot($value)
19
 * @mixin \Eloquent
20
 */
21
class CharacterInventory extends CharacterBaseModel
22
{
23
24
    /**
25
    * @inheritdoc
26
    * @var string
27
    */
28
    protected $table = 'character_inventory';
29
    /**
30
    * @inheritdoc
31
    * @var string
32
    */
33
    protected $primaryKey = 'item';
34
    /**
35
    * @inheritdoc
36
    * @var bool
37
    */
38
    public $incrementing = false;
39
    /**
40
    * @inheritdoc
41
    * @var bool
42
    */
43
    public $timestamps = false;
44
    /**
45
    * @inheritdoc
46
    * @var array
47
    */
48
    protected $casts = [
49
        'guid' => 'int',
50
        'bag' => 'int',
51
        'slot' => 'int',
52
        'item' => 'int'
53
    ];
54
    /**
55
    * @inheritdoc
56
    * @var array
57
    */
58
    protected $fillable = [
59
        'guid',
60
        'bag',
61
        'slot',
62
        'item'
63
    ];
64
65
    /**
66
     * Get reverence for the item
67
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
68
     */
69
    public function reference()
70
    {
71
        return $this->hasOne(ItemInstance::class, 'guid', 'item');
72
    }
73
}
74