mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
增加访问分析缓存
This commit is contained in:
@@ -14,6 +14,11 @@ class PostVisit extends Model
|
||||
{
|
||||
//
|
||||
|
||||
protected $json = [
|
||||
'client_os',
|
||||
'client',
|
||||
];
|
||||
|
||||
public function post()
|
||||
{
|
||||
return $this->belongsTo(Post::class, 'post_id');
|
||||
@@ -55,4 +60,21 @@ class PostVisit extends Model
|
||||
|
||||
return show_time_ago($value);
|
||||
}
|
||||
|
||||
public function getClientNameAttr()
|
||||
{
|
||||
$client = $this->getAttr('client');
|
||||
|
||||
return $client->name ?? '';
|
||||
}
|
||||
|
||||
public function getClientOsNameAttr()
|
||||
{
|
||||
$client_os = $this->getAttr('client_os');
|
||||
|
||||
$name = $client_os->name ?? '';
|
||||
$version = $client_os->version ?? '';
|
||||
|
||||
return "$name $version";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user