mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 17:28:55 +00:00
54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class UserActivity extends Model
|
|
{
|
|
const UPDATED_AT = null;
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'username',
|
|
'activity_type',
|
|
'description',
|
|
'metadata',
|
|
'is_permanent',
|
|
];
|
|
|
|
protected $casts = [
|
|
'metadata' => 'array',
|
|
'created_at' => 'datetime',
|
|
'is_permanent' => 'boolean',
|
|
];
|
|
|
|
/**
|
|
* Get icon class based on activity type
|
|
*/
|
|
public function getIconAttribute(): string
|
|
{
|
|
return match ($this->activity_type) {
|
|
'registered' => 'user-plus',
|
|
'deleted' => 'user-times',
|
|
'role_updated' => 'user-shield',
|
|
default => 'info-circle',
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Get color class based on activity type
|
|
*/
|
|
public function getColorClassAttribute(): string
|
|
{
|
|
return match ($this->activity_type) {
|
|
'registered' => 'green',
|
|
'deleted' => 'red',
|
|
'role_updated' => 'blue',
|
|
default => 'gray',
|
|
};
|
|
}
|
|
}
|