| 1 | <?php |
||
| 7 | class AuditableTraitObserver |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Model's creating event hook. |
||
| 11 | * |
||
| 12 | * @param Model $model |
||
| 13 | */ |
||
| 14 | public function creating(Model $model) |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Get authenticated user id depending on model's auth guard. |
||
| 30 | * |
||
| 31 | * @return int |
||
| 32 | */ |
||
| 33 | protected function getAuthenticatedUserId() |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Model's updating event hook. |
||
| 40 | * |
||
| 41 | * @param Model $model |
||
| 42 | */ |
||
| 43 | public function updating(Model $model) |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Set updatedBy column on save if value is not the same. |
||
| 54 | * |
||
| 55 | * @param \Illuminate\Database\Eloquent\Model $model |
||
| 56 | */ |
||
| 57 | public function saved(Model $model) |
||
| 66 | } |
||
| 67 |