You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelfed/app/UserDevice.php

36 lines
588 B
PHTML

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Jenssegers\Agent\Agent;
class UserDevice extends Model
{
6 months ago
protected $fillable = [
'user_id',
'ip',
'user_agent',
];
public $timestamps = [
6 months ago
'last_active_at',
];
public function user()
{
6 months ago
return $this->belongsTo(User::class);
}
public function getUserAgent()
{
6 months ago
if (! $this->user_agent) {
return 'Unknown';
}
6 months ago
$agent = new Agent;
$agent->setUserAgent($this->user_agent);
6 months ago
return $agent;
}
}