| Total Complexity | 2 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class UserActivity extends Model |
||
| 8 | { |
||
| 9 | const UPDATED_AT = null; |
||
| 10 | |||
| 11 | protected $fillable = [ |
||
| 12 | 'user_id', |
||
| 13 | 'username', |
||
| 14 | 'activity_type', |
||
| 15 | 'description', |
||
| 16 | 'metadata', |
||
| 17 | ]; |
||
| 18 | |||
| 19 | protected $casts = [ |
||
| 20 | 'metadata' => 'array', |
||
| 21 | 'created_at' => 'datetime', |
||
| 22 | ]; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Get icon class based on activity type |
||
| 26 | */ |
||
| 27 | public function getIconAttribute(): string |
||
| 28 | { |
||
| 29 | return match ($this->activity_type) { |
||
| 30 | 'registered' => 'user-plus', |
||
| 31 | 'deleted' => 'user-times', |
||
| 32 | 'role_updated' => 'user-shield', |
||
| 33 | default => 'info-circle', |
||
| 34 | }; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Get color class based on activity type |
||
| 39 | */ |
||
| 40 | public function getColorClassAttribute(): string |
||
| 47 | }; |
||
| 48 | } |
||
| 50 |