File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 22
33namespace Binafy \LaravelUserMonitoring \Models ;
44
5+ use Binafy \LaravelUserMonitoring \Utills \ActionType ;
56use Illuminate \Database \Eloquent \Model ;
67
78class ActionMonitoring extends Model
@@ -22,21 +23,27 @@ class ActionMonitoring extends Model
2223
2324 # Methods
2425
26+ /**
27+ * Get the type color by action type.
28+ */
2529 public function getTypeColor (): string
2630 {
2731 return match ($ this ->action_type ) {
28- ' read ' => 'blue ' ,
29- ' store ' => 'green ' ,
30- ' update ' => 'purple ' ,
31- ' delete ' => 'red ' ,
32- ' restore ' => 'yellow ' ,
33- ' replicate ' => 'pink ' ,
32+ ActionType:: ACTION_READ => 'blue ' ,
33+ ActionType:: ACTION_STORE => 'green ' ,
34+ ActionType:: ACTION_UPDATE => 'purple ' ,
35+ ActionType:: ACTION_DELETE => 'red ' ,
36+ ActionType:: ACTION_RESTORED => 'yellow ' ,
37+ ActionType:: ACTION_REPLICATE => 'pink ' ,
3438 default => 'gray ' ,
3539 };
3640 }
3741
3842 # Relations
3943
44+ /**
45+ * Relation one-to-many, User model.
46+ */
4047 public function user (): \Illuminate \Database \Eloquent \Relations \BelongsTo
4148 {
4249 return $ this ->belongsTo (
You can’t perform that action at this time.
0 commit comments