1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 00:05:29 +00:00
pixelfed/app/UserDevice.php

35 lines
555 B
PHP
Raw Normal View History

2019-03-06 07:55:03 +00:00
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
2019-04-15 19:21:33 +00:00
use Jenssegers\Agent\Agent;
2019-03-06 07:55:03 +00:00
class UserDevice extends Model
{
protected $fillable = [
'user_id',
'ip',
'user_agent'
];
public $timestamps = [
'last_active_at'
];
public function user()
{
return $this->belongsTo(User::class);
}
2019-04-15 19:21:33 +00:00
public function getUserAgent()
{
if(!$this->user_agent) {
return 'Unknown';
}
$agent = new Agent();
$agent->setUserAgent($this->user_agent);
return $agent;
}
2019-03-06 07:55:03 +00:00
}