Passed
Push — master ( b1742c...4b0d05 )
by Arthur
101:17 queued 94:42
created

Machine::accounts()   A

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 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 0
cts 0
cp 0
crap 2
1
<?php
2
3
namespace Modules\Machine\Entities;
4
5
use Foundation\Contracts\Ownable;
6
use Foundation\Traits\ModelFactory;
7
use Foundation\Traits\Notifiable;
8
use Foundation\Traits\OwnedByUser;
9
use Jenssegers\Mongodb\Eloquent\SoftDeletes;
10
use Modules\Account\Entities\Account;
11
use Modules\Mongo\Abstracts\MongoModel;
12
use Modules\User\Entities\User;
13
14
/**
15
 * Class User.
16
 *
17
 * @property string $_id
18
 * @property string $id
19
 * @property string $username
20
 * @property string $email
21
 * @property string $name
22
 * @property string $avatar
23
 * @property string $provider
24
 */
25
class Machine extends MongoModel implements Ownable
26
{
27
    use Notifiable, OwnedByUser, ModelFactory, SoftDeletes;
0 ignored issues
show
Bug introduced by
The trait Foundation\Traits\Notifiable requires the property $phone_number which is not provided by Modules\Machine\Entities\Machine.
Loading history...
28
29
    /**
30
     * @var string
31
     */
32
    protected $collection = 'machines';
33
34
    /**
35
     * @var array
36
     */
37
    protected $guarded = [];
38
39
    protected $casts = [
40
        'online' => 'boolean',
41
        'active' => 'boolean',
42
    ];
43
44
    protected $dates = [
45
        'created_at',
46
        'updated_at',
47
        'deleted_at',
48
        'last_heartbeat',
49
    ];
50 3
51
    public function user()
52 3
    {
53
        return $this->belongsTo(User::class);
54
    }
55
56
    public function accounts()
57
    {
58
        return $this->hasMany(Account::class);
59
    }
60
}
61