Passed
Push — feature/job-status-transitions ( 5d9982...db421e )
by Tristan
08:41 queued 04:46
created

JobPosterStatusTransition::owner_user_role()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * Created by Reliese Model.
5
 * Date: Thu, 12 Jul 2018 22:39:27 +0000.
6
 */
7
8
namespace App\Models\Lookup;
9
10
use App\Models\BaseModel;
11
12
use Backpack\CRUD\app\Models\Traits\CrudTrait;
13
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
14
15
/**
16
 * Class Department
17
 * @property int $id
18
 * @property string $key
19
 * @property int $owner_user_role_id
20
 * @property int $from_job_poster_status_id
21
 * @property int $to_job_poster_status_id
22
 * @property array $metadata
23
 *
24
 * @property \Jenssegers\Date\Date $created_at
25
 * @property \Jenssegers\Date\Date $updated_at
26
 *
27
 * @property \App\Models\UserRole $owner_user_role
28
 * @property \App\Models\Lookup\JobPosterStatus $from
29
 * @property \App\Models\Lookup\JobPosterStatus $to
30
 *
31
 * Localized Properties:
32
 * @property string $name
33
 */
34
class JobPosterStatusTransition extends BaseModel
35
{
36
    use CrudTrait;
37
    use HasTranslations;
38
39
    /**
40
     * All the fields must be fillable by admin portal
41
     *
42
     * @var string[]
43
     */
44
    protected $fillable = [
45
        'key',
46
        'owner_user_role_id',
47
        'from_job_poster_status_id',
48
        'to_job_poster_status_id',
49
        'metadata',
50
        'name'
51
    ];
52
53
    /**
54
     * @var string[] $casts
55
     */
56
    protected $casts = [
57
        'metadata' => 'array'
58
    ];
59
60
    /**
61
     * @var string[] $translatable
62
     * */
63
    public $translatable = [
64
        'name',
65
    ];
66
67
    /**
68
     * Allows the Backpack admin portal to edit json fields.
69
     *
70
     * @var string
71
     */
72
    public $fakeColumns = ['metadata'];
73
74
    public function owner_user_role() // phpcs:ignore
75
    {
76
        return $this->belongsTo(\App\Models\UserRole::class, 'owner_user_role_id');
77
    }
78
79
    public function from() // phpcs:ignore
80
    {
81
        return $this->belongsTo(\App\Models\Lookup\JobPosterStatus::class, 'from_job_poster_status_id');
82
    }
83
84
    public function to() // phpcs:ignore
85
    {
86
        return $this->belongsTo(\App\Models\Lookup\JobPosterStatus::class, 'to_job_poster_status_id');
87
    }
88
}
89