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

User   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 30
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A ownedBy() 0 3 1
A machines() 0 3 1
A ownerId() 0 3 1
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