mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-21 22:11:26 +00:00
Update UserDevice model
This commit is contained in:
parent
d1b3458604
commit
44fb6fa062
1 changed files with 11 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Jenssegers\Agent\Agent;
|
||||
|
||||
class UserDevice extends Model
|
||||
{
|
||||
|
@ -20,4 +21,14 @@ class UserDevice extends Model
|
|||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function getUserAgent()
|
||||
{
|
||||
if(!$this->user_agent) {
|
||||
return 'Unknown';
|
||||
}
|
||||
$agent = new Agent();
|
||||
$agent->setUserAgent($this->user_agent);
|
||||
return $agent;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue