Total Complexity | 5 |
Total Lines | 62 |
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 bootUserStamps() |
||
15 | { |
||
16 | static::observe(UserStampObserver::class); |
||
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 | ); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Get the user that edited the model. |
||
34 | * |
||
35 | * @return Illuminate\Database\Eloquent\Relations\BelongsTo |
||
36 | */ |
||
37 | public function editor() |
||
38 | { |
||
39 | return $this->belongsTo( |
||
40 | config('userstamps.users_model'), |
||
41 | config('userstamps.updated_by_column') |
||
42 | ); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Get the user that deleted the model. |
||
47 | * |
||
48 | * @return Illuminate\Database\Eloquent\Relations\BelongsTo |
||
49 | */ |
||
50 | public function destroyer() |
||
55 | ); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Has the model loaded the SoftDeletes trait. |
||
60 | * |
||
61 | * @return bool |
||
62 | */ |
||
63 | public function usingSoftDeletes() |
||
69 | ) |
||
70 | ); |
||
71 | } |
||
72 | } |
||
73 |