User   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 50
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A student() 0 3 1
A isAdmin() 0 3 1
A isStudent() 0 3 1
1
<?php
2
3
namespace App\Judite\Models;
4
5
use Illuminate\Notifications\Notifiable;
6
use Illuminate\Foundation\Auth\User as Authenticatable;
7
8
class User extends Authenticatable
9
{
10
    use Notifiable;
0 ignored issues
show
introduced by
The trait Illuminate\Notifications\Notifiable requires some properties which are not provided by App\Judite\Models\User: $email, $phone_number
Loading history...
11
12
    /**
13
     * The attributes that are mass assignable.
14
     *
15
     * @var array
16
     */
17
    protected $fillable = [
18
        'name', 'email', 'password',
19
    ];
20
21
    /**
22
     * The attributes that should be hidden for arrays.
23
     *
24
     * @var array
25
     */
26
    protected $hidden = [
27
        'password', 'remember_token',
28
    ];
29
30
    /**
31
     * Get student of this user.
32
     *
33
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
34
     */
35
    public function student()
36
    {
37
        return $this->hasOne(Student::class);
38
    }
39
40
    /**
41
     * Check if the user is an Admin.
42
     *
43
     * @return bool
44
     */
45
    public function isAdmin(): bool
46
    {
47
        return $this->is_admin;
48
    }
49
50
    /**
51
     * Check if the user is a Student.
52
     *
53
     * @return bool
54
     */
55
    public function isStudent(): bool
56
    {
57
        return ! is_null($this->student);
58
    }
59
}
60