Update UserDevice model

This commit is contained in:
Daniel Supernault 2019-04-15 13:21:33 -06:00
parent d1b3458604
commit 44fb6fa062
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -3,6 +3,7 @@
namespace App; namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Jenssegers\Agent\Agent;
class UserDevice extends Model class UserDevice extends Model
{ {
@ -20,4 +21,14 @@ class UserDevice extends Model
{ {
return $this->belongsTo(User::class); return $this->belongsTo(User::class);
} }
public function getUserAgent()
{
if(!$this->user_agent) {
return 'Unknown';
}
$agent = new Agent();
$agent->setUserAgent($this->user_agent);
return $agent;
}
} }