|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Webfactor\Laravel\Backpack\Documents\Models; |
|
4
|
|
|
|
|
5
|
|
|
use Backpack\CRUD\CrudTrait; |
|
6
|
|
|
use Backpack\CRUD\ModelTraits\SpatieTranslatable\HasTranslations; |
|
7
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Webfactor\Laravel\Backpack\Documents\Models\Document |
|
11
|
|
|
* |
|
12
|
|
|
* @property int $id |
|
13
|
|
|
* @property string $title |
|
14
|
|
|
* @property string $body |
|
15
|
|
|
* @property string $type |
|
16
|
|
|
* @property \Carbon\Carbon|null $created_at |
|
17
|
|
|
* @property \Carbon\Carbon|null $updated_at |
|
18
|
|
|
* @property-read mixed $translated_type |
|
19
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Webfactor\Laravel\Backpack\Documents\Models\Document whereBody($value) |
|
20
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Webfactor\Laravel\Backpack\Documents\Models\Document whereCreatedAt($value) |
|
21
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Webfactor\Laravel\Backpack\Documents\Models\Document whereId($value) |
|
22
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Webfactor\Laravel\Backpack\Documents\Models\Document whereTitle($value) |
|
23
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Webfactor\Laravel\Backpack\Documents\Models\Document whereType($value) |
|
24
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\Webfactor\Laravel\Backpack\Documents\Models\Document whereUpdatedAt($value) |
|
25
|
|
|
* @mixin \Eloquent |
|
26
|
|
|
*/ |
|
27
|
|
|
class Document extends Model |
|
28
|
|
|
{ |
|
29
|
|
|
use CrudTrait; |
|
30
|
|
|
use HasTranslations; |
|
31
|
|
|
|
|
32
|
|
|
/* |
|
33
|
|
|
|-------------------------------------------------------------------------- |
|
34
|
|
|
| GLOBAL VARIABLES |
|
35
|
|
|
|-------------------------------------------------------------------------- |
|
36
|
|
|
*/ |
|
37
|
|
|
|
|
38
|
|
|
protected $fillable = [ |
|
39
|
|
|
'type', |
|
40
|
|
|
'title', |
|
41
|
|
|
'body' |
|
42
|
|
|
]; |
|
43
|
|
|
|
|
44
|
|
|
protected $translatable = [ |
|
45
|
|
|
'title', |
|
46
|
|
|
'body' |
|
47
|
|
|
]; |
|
48
|
|
|
|
|
49
|
|
|
/* |
|
50
|
|
|
|-------------------------------------------------------------------------- |
|
51
|
|
|
| FUNCTIONS |
|
52
|
|
|
|-------------------------------------------------------------------------- |
|
53
|
|
|
*/ |
|
54
|
|
|
|
|
55
|
|
|
/* |
|
56
|
|
|
|-------------------------------------------------------------------------- |
|
57
|
|
|
| RELATIONS |
|
58
|
|
|
|-------------------------------------------------------------------------- |
|
59
|
|
|
*/ |
|
60
|
|
|
|
|
61
|
|
|
/* |
|
62
|
|
|
|-------------------------------------------------------------------------- |
|
63
|
|
|
| SCOPES |
|
64
|
|
|
|-------------------------------------------------------------------------- |
|
65
|
|
|
*/ |
|
66
|
|
|
|
|
67
|
|
|
/* |
|
68
|
|
|
|-------------------------------------------------------------------------- |
|
69
|
|
|
| ACCESORS |
|
70
|
|
|
|-------------------------------------------------------------------------- |
|
71
|
|
|
*/ |
|
72
|
|
|
|
|
73
|
|
|
public function getTranslatedTypeAttribute() |
|
74
|
|
|
{ |
|
75
|
|
|
return trans('webfactor::documents.types.'.$this->type); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/* |
|
79
|
|
|
|-------------------------------------------------------------------------- |
|
80
|
|
|
| MUTATORS |
|
81
|
|
|
|-------------------------------------------------------------------------- |
|
82
|
|
|
*/ |
|
83
|
|
|
} |
|
84
|
|
|
|