Recruitment::predefinedMessages()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Recruitment extends Model
8
{
9
    const STATE_PUBLISHED = 0;
10
    const STATE_FINISHED = 1;
11
    const STATE_CLOSED = 2;
12
13
    protected $connection = 'tenant';
14
15
    protected $fillable = [
16
        'name',
17
        'notification_email',
18
        'job_title',
19
        'is_draft',
20
    ];
21
22
    public function candidates()
23
    {
24
        return $this->hasMany(Candidate::class);
25
    }
26
27
    public function sources()
28
    {
29
        return $this->hasMany(Source::class);
30
    }
31
32
    public function predefinedMessages()
33
    {
34
        return $this->hasMany(PredefinedMessage::class);
35
    }
36
37
    public function formFields()
38
    {
39
        return $this->hasMany(FormField::class)->orderBy('order');
40
    }
41
42
    public function stages()
43
    {
44
        return $this->hasMany(Stage::class)->orderBy('order');
45
    }
46
47
    /**
48
     * Used to determine access rights if a user has limited role.
49
     *
50
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
51
     */
52
    public function grantedUsers()
53
    {
54
        return $this->belongsToMany(User::class)->withTimestamps();
55
    }
56
}
57