Passed
Push — task/applicant-classification-... ( 9f4daa )
by Yonathan
07:44
created

Classification::job_posters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Models;
4
5
use Backpack\CRUD\app\Models\Traits\CrudTrait;
6
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
7
8
/**
9
 * Class UserRole.
10
 *
11
 * @property int $id
12
 * @property string $key
13
 * @property string $education_requirements
14
 * @property \Jenssegers\Date\Date $created_at
15
 * @property \Jenssegers\Date\Date $updated_at
16
 * @property \Illuminate\Database\Eloquent\Collection $skills
17
 * @property \Illuminate\Database\Eloquent\Collection $job_posters
18
 */
19
class Classification extends BaseModel
20
{
21
    use CrudTrait;
22
    use HasTranslations;
23
24
    /**
25
     * @var string
26
     */
27
    protected $fillable = [
28
        'key',
29
        'education_requirements',
30
    ];
31
32
    public $translatable = [
33
        'education_requirements',
34
    ];
35
36
    public function skills()
37
    {
38
        return $this->belongsToMany(\App\Models\Skill::class)->withTimestamps();
39
    }
40
41
    public function job_posters() //phpcs:ignore
42
    {
43
        return $this->belongsToMany(\App\Models\JobPoster::class);
44
    }
45
46
    public function applicants() //phpcs:ignore
47
    {
48
        return $this->belongsToMany(\App\Models\Applicant::class)
49
        ->withPivot(['level', 'order'])
50
        ->as('gov_classification')
51
        ->withTimestamps();
52
    }
53
}
54