| 123456789101112131415161718192021 |
- <?php
- namespace App\Models\Agent;
- use App\Models\BaseModel;
- class AgentLoginLog extends BaseModel
- {
- protected $table = 'agent_login_logs';
- protected $fillable = ['agent_id', 'username', 'domain', 'ip', 'country', 'region', 'city', 'device', 'user_agent', 'login_at'];
- protected $hidden = [];
- protected $appends = ['device_text', 'location'];
- protected $casts = ['agent_id' => 'integer', 'login_at' => 'datetime'];
- public function getDeviceTextAttribute(): string
- {
- return $this->device === 'mobile' ? '手机端' : '电脑端';
- }
- public function getLocationAttribute(): string
- {
- return implode(' ', array_filter([$this->country, $this->region, $this->city]));
- }
- }
|