|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Models; |
|
4
|
|
|
|
|
5
|
|
|
use Carbon\Carbon; |
|
6
|
|
|
use Illuminate\Database\Eloquent\Builder; |
|
7
|
|
|
use Illuminate\Database\Eloquent\Collection; |
|
8
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany; |
|
9
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes; |
|
10
|
|
|
use Illuminate\Database\Query\Builder as QueryBuilder; |
|
11
|
|
|
use IonGhitun\MysqlEncryption\Models\BaseModel; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class Language |
|
15
|
|
|
* |
|
16
|
|
|
* @property int $id |
|
17
|
|
|
* @property string $name |
|
18
|
|
|
* @property string $code |
|
19
|
|
|
* @property Carbon|null $created_at |
|
20
|
|
|
* @property Carbon|null $updated_at |
|
21
|
|
|
* @property Carbon|null $deleted_at |
|
22
|
|
|
* |
|
23
|
|
|
* @property-read Collection|User[] $users |
|
24
|
|
|
* @property-read int|null $users_count |
|
25
|
|
|
* |
|
26
|
|
|
* @method static Builder|Language newModelQuery() |
|
27
|
|
|
* @method static Builder|Language newQuery() |
|
28
|
|
|
* @method static Builder|Language query() |
|
29
|
|
|
* @method static Builder|Language whereCode($value) |
|
30
|
|
|
* @method static Builder|Language whereCreatedAt($value) |
|
31
|
|
|
* @method static Builder|Language whereDeletedAt($value) |
|
32
|
|
|
* @method static Builder|Language whereId($value) |
|
33
|
|
|
* @method static Builder|Language whereName($value) |
|
34
|
|
|
* @method static Builder|Language whereUpdatedAt($value) |
|
35
|
|
|
* @method static QueryBuilder|Language onlyTrashed() |
|
36
|
|
|
* @method static QueryBuilder|Language withTrashed() |
|
37
|
|
|
* @method static QueryBuilder|Language withoutTrashed() |
|
38
|
|
|
* @method static Builder|BaseModel orWhereEncrypted($column, $value) |
|
39
|
|
|
* @method static Builder|BaseModel orWhereNotEncrypted($column, $value) |
|
40
|
|
|
* @method static Builder|BaseModel orderByEncrypted($column, $direction) |
|
41
|
|
|
* @method static Builder|BaseModel whereEncrypted($column, $value) |
|
42
|
|
|
* @method static Builder|BaseModel whereNotEncrypted($column, $value) |
|
43
|
|
|
* |
|
44
|
|
|
* @package App\Models |
|
45
|
|
|
*/ |
|
46
|
|
|
class Language extends Model |
|
47
|
|
|
{ |
|
48
|
|
|
use SoftDeletes; |
|
49
|
|
|
|
|
50
|
|
|
/** @var int */ |
|
51
|
|
|
const ID_EN = 1; |
|
52
|
|
|
|
|
53
|
|
|
/** @var int */ |
|
54
|
|
|
const ID_RO = 2; |
|
55
|
|
|
|
|
56
|
|
|
/** @var string */ |
|
57
|
|
|
const CODE_EN = 'en'; |
|
58
|
|
|
|
|
59
|
|
|
/** @var string */ |
|
60
|
|
|
const CODE_RO = 'ro'; |
|
61
|
|
|
|
|
62
|
|
|
/** @var bool */ |
|
63
|
|
|
public $timestamps = true; |
|
64
|
|
|
|
|
65
|
|
|
/** @var string */ |
|
66
|
|
|
protected $table = 'languages'; |
|
67
|
|
|
|
|
68
|
|
|
/** @var array */ |
|
69
|
|
|
protected $fillable = [ |
|
70
|
|
|
'name', |
|
71
|
|
|
'code' |
|
72
|
|
|
]; |
|
73
|
|
|
|
|
74
|
|
|
/** @var array */ |
|
75
|
|
|
protected $visible = [ |
|
76
|
|
|
'id', |
|
77
|
|
|
'name', |
|
78
|
|
|
'code' |
|
79
|
|
|
]; |
|
80
|
|
|
|
|
81
|
|
|
/** @var array */ |
|
82
|
|
|
protected $sortable = [ |
|
83
|
|
|
'id', |
|
84
|
|
|
'name', |
|
85
|
|
|
'code' |
|
86
|
|
|
]; |
|
87
|
|
|
|
|
88
|
|
|
/** @var array */ |
|
89
|
|
|
protected $searchable = [ |
|
90
|
|
|
'name', |
|
91
|
|
|
'code' |
|
92
|
|
|
]; |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* language users. |
|
96
|
|
|
* |
|
97
|
|
|
* @return HasMany |
|
98
|
|
|
*/ |
|
99
|
|
|
public function users() |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->hasMany(User::class, 'language_id', 'id'); |
|
102
|
|
|
} |
|
103
|
|
|
} |
|
104
|
|
|
|