1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Models; |
4
|
|
|
|
5
|
|
|
use App\Helpers\Macros\Traits\Languages; |
6
|
|
|
use App\Models\Traits\BelongsToElement; |
7
|
|
|
use App\Models\Traits\BelongsToElementset; |
8
|
|
|
use App\Models\Traits\BelongsToImport; |
9
|
|
|
use App\Models\Traits\BelongsToProfileProperty; |
10
|
|
|
use App\Models\Traits\BelongsToRelatedElement; |
11
|
|
|
use App\Models\Traits\HasStatus; |
12
|
|
|
use Culpa\Traits\Blameable; |
13
|
|
|
use Culpa\Traits\CreatedBy; |
14
|
|
|
use Illuminate\Database\Eloquent\Model as Model; |
15
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo; |
16
|
|
|
use Laracasts\Matryoshka\Cacheable; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* App\Models\ElementAttributeHistory |
20
|
|
|
* |
21
|
|
|
* @property int $id |
22
|
|
|
* @property \Carbon\Carbon|null $created_at |
23
|
|
|
* @property \Carbon\Carbon|null $updated_at |
24
|
|
|
* @property int $created_user_id |
25
|
|
|
* @property string $action |
26
|
|
|
* @property int $schema_property_element_id |
27
|
|
|
* @property int $schema_property_id |
28
|
|
|
* @property int $schema_id |
29
|
|
|
* @property int $profile_property_id |
30
|
|
|
* @property string $object |
31
|
|
|
* @property int $related_schema_property_id |
32
|
|
|
* @property string $language |
33
|
|
|
* @property int $status_id |
34
|
|
|
* @property string $change_note |
35
|
|
|
* @property int $import_id |
36
|
|
|
* @property int|null $created_by |
37
|
|
|
* @property-read \App\Models\Access\User\User|null $creator |
38
|
|
|
* @property-read \App\Models\Element|null $element |
39
|
|
|
* @property-read \App\Models\ElementAttribute|null $element_attribute |
40
|
|
|
* @property-read \App\Models\Elementset|null $elementset |
41
|
|
|
* @property mixed $languages |
42
|
|
|
* @property-read \App\Models\Import|null $import |
43
|
|
|
* @property-read \App\Models\ProfileProperty|null $profile_property |
44
|
|
|
* @property-read \App\Models\Element|null $related_element |
45
|
|
|
* @property-read \App\Models\Status|null $status |
46
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereAction($value) |
47
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereChangeNote($value) |
48
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereCreatedAt($value) |
49
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereCreatedBy($value) |
50
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereCreatedUserId($value) |
51
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereId($value) |
52
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereImportId($value) |
53
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereLanguage($value) |
54
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereObject($value) |
55
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereProfilePropertyId($value) |
56
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereRelatedSchemaPropertyId($value) |
57
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereSchemaId($value) |
58
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereSchemaPropertyElementId($value) |
59
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereSchemaPropertyId($value) |
60
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereStatusId($value) |
61
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ElementAttributeHistory whereUpdatedAt($value) |
62
|
|
|
* @mixin \Eloquent |
63
|
|
|
*/ |
64
|
|
|
class ElementAttributeHistory extends Model |
65
|
|
|
{ |
66
|
|
|
//TODO: Only store the things that change and get the rest from the related attribute. |
67
|
|
|
const TABLE = 'reg_schema_property_element_history'; |
68
|
|
|
protected $table = self::TABLE; |
69
|
|
|
use Blameable, CreatedBy; |
70
|
|
|
use Cacheable; |
|
|
|
|
71
|
|
|
use Languages, HasStatus, BelongsToProfileProperty, BelongsToElementset, BelongsToElement, BelongsToImport, BelongsToRelatedElement; |
72
|
|
|
protected $blameable = [ |
73
|
|
|
'created' => 'created_user_id', |
74
|
|
|
]; |
75
|
|
|
protected $guarded = ['id']; |
76
|
|
|
protected $casts = [ |
77
|
|
|
'id' => 'integer', |
78
|
|
|
'created_user_id' => 'integer', //CreatedBy |
79
|
|
|
'action' => 'string', |
80
|
|
|
'schema_property_element_id' => 'integer', //element_attribute |
81
|
|
|
'schema_property_id' => 'integer', //BelongsToElement |
82
|
|
|
'schema_id' => 'integer', //BelongsToElementset |
83
|
|
|
'profile_property_id' => 'integer', //BelongsToProfileProperty |
84
|
|
|
'object' => 'string', |
85
|
|
|
'related_schema_property_id' => 'integer', //BelongsToRelatedElement |
86
|
|
|
'language' => 'string', //languages |
87
|
|
|
'status_id' => 'integer', //hasStatus |
88
|
|
|
'change_note' => 'string', |
89
|
|
|
'import_id' => 'integer', //BelongsToImport |
90
|
|
|
]; |
91
|
|
|
public static $rules = [ |
92
|
|
|
'created_at' => 'required|', |
93
|
|
|
'object' => 'max:65535', |
94
|
|
|
'language' => 'required|max:10', |
95
|
|
|
'change_note' => 'max:65535', |
96
|
|
|
]; |
97
|
|
|
|
98
|
|
|
public function element_attribute(): ?BelongsTo |
99
|
|
|
{ |
100
|
|
|
return $this->belongsTo(ElementAttribute::class, |
101
|
|
|
'schema_property_element_id', |
102
|
|
|
'id'); |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|