mirror of https://github.com/pixelfed/pixelfed
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.
30 lines
497 B
PHTML
30 lines
497 B
PHTML
|
8 years ago
|
<?php
|
||
|
|
|
||
|
4 weeks ago
|
namespace App\Models;
|
||
|
8 years ago
|
|
||
|
1 month ago
|
use App\Services\UserAgentService;
|
||
|
4 weeks ago
|
use Illuminate\Database\Eloquent\Model;
|
||
|
8 years ago
|
|
||
|
|
class UserDevice extends Model
|
||
|
|
{
|
||
|
4 weeks ago
|
protected $guarded = [];
|
||
|
8 years ago
|
|
||
|
|
public $timestamps = [
|
||
|
9 months ago
|
'last_active_at',
|
||
|
8 years ago
|
];
|
||
|
|
|
||
|
|
public function user()
|
||
|
|
{
|
||
|
9 months ago
|
return $this->belongsTo(User::class);
|
||
|
8 years ago
|
}
|
||
|
8 years ago
|
|
||
|
|
public function getUserAgent()
|
||
|
|
{
|
||
|
9 months ago
|
if (! $this->user_agent) {
|
||
|
8 years ago
|
return 'Unknown';
|
||
|
|
}
|
||
|
9 months ago
|
|
||
|
1 month ago
|
return new UserAgentService($this->user_agent);
|
||
|
8 years ago
|
}
|
||
|
8 years ago
|
}
|