Passed
Push — dev ( 72e705...fb30f4 )
by Chris
05:36 queued 13s
created

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