| Total Complexity | 5 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | trait HasUserStamps |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Bootstrap the trait. |
||
| 11 | * |
||
| 12 | * @return void |
||
| 13 | */ |
||
| 14 | public static function bootHasUserStamps() |
||
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Get the user that created the model. |
||
| 21 | * |
||
| 22 | * @return Illuminate\Database\Eloquent\Relations\BelongsTo |
||
|
|
|||
| 23 | */ |
||
| 24 | public function author() |
||
| 25 | { |
||
| 26 | return $this->belongsTo( |
||
| 27 | config('userstamps.users_model'), |
||
| 28 | config('userstamps.created_by_column'), |
||
| 29 | config('userstamps.users_table_column_id_name') |
||
| 30 | ); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Get the user that edited the model. |
||
| 35 | * |
||
| 36 | * @return Illuminate\Database\Eloquent\Relations\BelongsTo |
||
| 37 | */ |
||
| 38 | public function editor() |
||
| 39 | { |
||
| 40 | return $this->belongsTo( |
||
| 41 | config('userstamps.users_model'), |
||
| 42 | config('userstamps.updated_by_column'), |
||
| 43 | config('userstamps.users_table_column_id_name') |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Get the user that deleted the model. |
||
| 49 | * |
||
| 50 | * @return Illuminate\Database\Eloquent\Relations\BelongsTo |
||
| 51 | */ |
||
| 52 | public function destroyer() |
||
| 58 | ); |
||
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Has the model loaded the SoftDeletes trait. |
||
| 63 | * |
||
| 64 | * @return bool |
||
| 65 | */ |
||
| 66 | public function usingSoftDeletes() |
||
| 72 | ) |
||
| 73 | ); |
||
| 74 | } |
||
| 76 |