Passed
Push — master ( 7bc374...cf39f3 )
by Arthur
05:05
created

User::ownedBy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Modules\User\Entities;
4
5
use Foundation\Abstracts\MongoModel;
6
use Foundation\Contracts\Ownable;
7
use Foundation\Traits\Cacheable;
8
use Foundation\Traits\Notifiable;
9
use Illuminate\Auth\Authenticatable;
10
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
11
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
12
use Illuminate\Foundation\Auth\Access\Authorizable;
13
use Modules\Auth0\Traits\Auth0Model;
14
use Modules\Machine\Entities\Machine;
15
16
/**
17
 * Class User.
18
 *
19
 * @property string $_id
20
 * @property string $id
21
 * @property string $username
22
 * @property string $email
23
 * @property string $name
24
 * @property string $avatar
25
 * @property string $provider
26
 */
27
class User extends MongoModel implements AuthorizableContract, AuthenticatableContract, Ownable
28
{
29
    use Notifiable, Authorizable, Authenticatable, Cacheable, Auth0Model;
0 ignored issues
show
Bug introduced by
The trait Foundation\Traits\Notifiable requires the property $phone_number which is not provided by Modules\User\Entities\User.
Loading history...
Bug introduced by
The trait Illuminate\Auth\Authenticatable requires the property $password which is not provided by Modules\User\Entities\User.
Loading history...
30
31
    /**
32
     * @var string
33
     */
34
    protected $collection = 'users';
35
36
    /**
37
     * @var array
38
     */
39
    protected $guarded = [];
40
41
    /**
42
     * @return mixed
43
     */
44 2
    public function ownerId()
45
    {
46 2
        return $this->id;
47
    }
48
49 2
    public function ownedBy()
50
    {
51 2
        return self::class;
52
    }
53
54 2
    public function machines()
55
    {
56 2
        return $this->hasMany(Machine::class, 'user_id', 'identity_id');
57
    }
58
}
59