Candidate   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
c 0
b 0
f 0
dl 0
loc 60
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A messages() 0 3 1
A activities() 0 3 1
A source() 0 3 1
A notes() 0 3 1
A recruitment() 0 3 1
A stage() 0 3 1
A scopeUnseen() 0 3 1
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\SoftDeletes;
7
8
class Candidate extends Model
9
{
10
    use SoftDeletes;
0 ignored issues
show
Bug introduced by
The trait Illuminate\Database\Eloquent\SoftDeletes requires the property $forceDeleting which is not provided by App\Models\Candidate.
Loading history...
11
12
    protected $connection = 'tenant';
13
14
    /**
15
     * The attributes that should be mutated to dates.
16
     *
17
     * @var array
18
     */
19
    protected $dates = ['deleted_at'];
20
21
    protected $fillable = [
22
        'name',
23
        'email',
24
        'phone_number',
25
        'recruitment_id',
26
    ];
27
28
    public function recruitment()
29
    {
30
        return $this->belongsTo(Recruitment::class);
31
    }
32
33
    public function source()
34
    {
35
        return $this->belongsTo(Source::class);
36
    }
37
38
    public function stage()
39
    {
40
        return $this->belongsTo(Stage::class);
41
    }
42
43
    public function notes()
44
    {
45
        return $this->hasMany(Note::class);
46
    }
47
48
    public function messages()
49
    {
50
        return $this->hasMany(Message::class);
51
    }
52
53
    public function activities()
54
    {
55
        return $this->hasMany(Activity::class);
56
    }
57
58
    /**
59
     * Scope a query to only include unseen candidates.
60
     *
61
     * @param \Illuminate\Database\Eloquent\Builder $query
62
     *
63
     * @return \Illuminate\Database\Eloquent\Builder
64
     */
65
    public function scopeUnseen($query)
66
    {
67
        return $query->where('stage_id', '=', Stage::STAGE_NEW);
68
    }
69
}
70