forked from mirror/pixelfed
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