1 | <?php |
||
9 | trait BlameableTrait |
||
10 | { |
||
11 | /** |
||
12 | * Get any of override 'blameable attributes'. |
||
13 | * |
||
14 | * @return array |
||
15 | */ |
||
16 | public function blameable() |
||
23 | |||
24 | /** |
||
25 | * Boot the Blameable service by attaching |
||
26 | * a new observer into the current model object. |
||
27 | * |
||
28 | * @return void |
||
29 | */ |
||
30 | public static function bootBlameableTrait() |
||
34 | |||
35 | /** |
||
36 | * Build blameable query scope. |
||
37 | * |
||
38 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
39 | * @param mixed $userId |
||
40 | * @param string $key |
||
41 | * |
||
42 | * @return \Illuminate\Database\Eloquent\Builder |
||
43 | */ |
||
44 | private function buildBlameableScope(Builder $query, $userId, $key) |
||
52 | |||
53 | /** |
||
54 | * Get the user who created the record. |
||
55 | * |
||
56 | * @return \Illuminate\Database\Eloquent\Model |
||
|
|||
57 | */ |
||
58 | public function creator() |
||
65 | |||
66 | /** |
||
67 | * Get the user who updated the record for the last time. |
||
68 | * |
||
69 | * @return \Illuminate\Database\Eloquent\Model |
||
70 | */ |
||
71 | public function updater() |
||
78 | |||
79 | /** |
||
80 | * createdBy Query Scope. |
||
81 | * |
||
82 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
83 | * @param mixed $userId |
||
84 | * |
||
85 | * @return \Illuminate\Database\Eloquent\Builder |
||
86 | */ |
||
87 | public function scopeCreatedBy(Builder $query, $userId) |
||
91 | |||
92 | /** |
||
93 | * updatedBy Query Scope. |
||
94 | * |
||
95 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
96 | * @param mixed $userId |
||
97 | * |
||
98 | * @return \Illuminate\Database\Eloquent\Builder |
||
99 | */ |
||
100 | public function scopeUpdatedBy(Builder $query, $userId) |
||
104 | |||
105 | /** |
||
106 | * Silently update the model without firing any |
||
107 | * events. |
||
108 | * |
||
109 | * @return int |
||
110 | */ |
||
111 | public function silentUpdate() |
||
122 | |||
123 | /** |
||
124 | * Confirm if the current model uses SoftDeletes. |
||
125 | * |
||
126 | * @return boolean |
||
127 | */ |
||
128 | public function useSoftDeletes() |
||
132 | |||
133 | /** |
||
134 | * Define an inverse one-to-one or many relationship. |
||
135 | * |
||
136 | * @param string $related |
||
137 | * @param string $foreignKey |
||
138 | * @param string $otherKey |
||
139 | * @param string $relation |
||
140 | * |
||
141 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
142 | */ |
||
143 | abstract public function belongsTo($related, $foreignKey = null, $otherKey = null, $relation = null); |
||
144 | |||
145 | /** |
||
146 | * Get the attributes that have been changed since last sync. |
||
147 | * |
||
148 | * @return array |
||
149 | */ |
||
150 | abstract public function getDirty(); |
||
151 | |||
152 | /** |
||
153 | * Get the primary key for the model. |
||
154 | * |
||
155 | * @return string |
||
156 | */ |
||
157 | abstract public function getKeyName(); |
||
158 | |||
159 | /** |
||
160 | * Get the value of the model's primary key. |
||
161 | * |
||
162 | * @return mixed |
||
163 | */ |
||
164 | abstract public function getKey(); |
||
165 | |||
166 | /** |
||
167 | * Get a new query builder that doesn't have any global scopes. |
||
168 | * |
||
169 | * @return \Illuminate\Database\Eloquent\Builder|static |
||
170 | */ |
||
171 | abstract public function newQueryWithoutScopes(); |
||
172 | } |
||
173 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.