1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Script Entity. |
4
|
|
|
* |
5
|
|
|
* @package App\Entities\Script |
6
|
|
|
* |
7
|
|
|
* @author Nick Menke <[email protected]> |
8
|
|
|
* @copyright 2018-2020 Nick Menke |
9
|
|
|
* |
10
|
|
|
* @link https://github.com/nlmenke/vertebrae |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
declare(strict_types=1); |
14
|
|
|
|
15
|
|
|
namespace App\Entities\Script; |
16
|
|
|
|
17
|
|
|
use App\Entities\AbstractEntity; |
18
|
|
|
use App\Entities\Locale\Locale; |
19
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany; |
20
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* The Script entity class. |
24
|
|
|
* |
25
|
|
|
* This class contains any functions required to access and manipulate script |
26
|
|
|
* models. |
27
|
|
|
* |
28
|
|
|
* @since x.x.x introduced |
29
|
|
|
*/ |
30
|
|
|
class Script extends AbstractEntity |
31
|
|
|
{ |
32
|
|
|
use SoftDeletes; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* The attributes that are mass assignable. |
36
|
|
|
* |
37
|
|
|
* @var array |
38
|
|
|
*/ |
39
|
|
|
protected $fillable = [ |
40
|
|
|
'iso_alpha', |
41
|
|
|
'iso_numeric', |
42
|
|
|
'name', |
43
|
|
|
'direction', |
44
|
|
|
]; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Get the direction attribute. |
48
|
|
|
* |
49
|
|
|
* @return string |
50
|
|
|
*/ |
51
|
|
|
public function getDirection(): string |
52
|
|
|
{ |
53
|
|
|
return $this->getAttribute('direction'); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Get the iso_alpha attribute. |
58
|
|
|
* |
59
|
|
|
* @return string |
60
|
|
|
*/ |
61
|
|
|
public function getIsoAlpha(): string |
62
|
|
|
{ |
63
|
|
|
return $this->getAttribute('iso_alpha'); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Get the iso_numeric attribute. |
68
|
|
|
* |
69
|
|
|
* @return string |
70
|
|
|
*/ |
71
|
|
|
public function getIsoNumeric(): string |
72
|
|
|
{ |
73
|
|
|
return $this->getAttribute('iso_numeric'); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Get the name attribute. |
78
|
|
|
* |
79
|
|
|
* @return string |
80
|
|
|
*/ |
81
|
|
|
public function getName(): string |
82
|
|
|
{ |
83
|
|
|
return $this->getAttribute('name'); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* The locales relationship instance. |
88
|
|
|
* |
89
|
|
|
* @return HasMany |
90
|
|
|
*/ |
91
|
|
|
public function locales(): HasMany |
92
|
|
|
{ |
93
|
|
|
return $this->hasMany(Locale::class); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|