1 | <?php namespace Arcanedev\LaravelTracker\Models; |
||
31 | class Session extends Model |
||
32 | { |
||
33 | /* ------------------------------------------------------------------------------------------------ |
||
34 | | Properties |
||
35 | | ------------------------------------------------------------------------------------------------ |
||
36 | */ |
||
37 | /** |
||
38 | * The table associated with the model. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $table = 'sessions'; |
||
43 | |||
44 | /** |
||
45 | * The attributes that are mass assignable. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $fillable = [ |
||
50 | 'uuid', |
||
51 | 'user_id', |
||
52 | 'device_id', |
||
53 | 'language_id', |
||
54 | 'agent_id', |
||
55 | 'client_ip', |
||
56 | 'cookie_id', |
||
57 | 'referer_id', |
||
58 | 'geoip_id', |
||
59 | 'is_robot', |
||
60 | ]; |
||
61 | |||
62 | /** |
||
63 | * The attributes that should be cast to native types. |
||
64 | * |
||
65 | * @var array |
||
66 | */ |
||
67 | protected $casts = [ |
||
68 | 'user_id' => 'integer', |
||
69 | 'device_id' => 'integer', |
||
70 | 'language_id' => 'integer', |
||
71 | 'agent_id' => 'integer', |
||
72 | 'cookie_id' => 'integer', |
||
73 | 'referer_id' => 'integer', |
||
74 | 'geoip_id' => 'integer', |
||
75 | 'is_robot' => 'boolean', |
||
76 | ]; |
||
77 | |||
78 | /* ------------------------------------------------------------------------------------------------ |
||
79 | | Relationships |
||
80 | | ------------------------------------------------------------------------------------------------ |
||
81 | */ |
||
82 | /** |
||
83 | * User relationship. |
||
84 | * |
||
85 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
86 | */ |
||
87 | public function user() |
||
93 | |||
94 | /** |
||
95 | * Device relationship. |
||
96 | * |
||
97 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
98 | */ |
||
99 | public function device() |
||
105 | |||
106 | /** |
||
107 | * Agent relationship. |
||
108 | * |
||
109 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
110 | */ |
||
111 | public function agent() |
||
117 | |||
118 | /** |
||
119 | * Referer relationship. |
||
120 | * |
||
121 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
122 | */ |
||
123 | public function referer() |
||
124 | { |
||
125 | return $this->belongsTo( |
||
126 | $this->getConfig('models.referer', Referer::class) |
||
127 | ); |
||
128 | } |
||
129 | |||
130 | /** |
||
131 | * Cookie relationship. |
||
132 | * |
||
133 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
134 | */ |
||
135 | public function cookie() |
||
141 | |||
142 | /** |
||
143 | * GeoIp relationship. |
||
144 | * |
||
145 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
146 | */ |
||
147 | public function geoIp() |
||
153 | |||
154 | /** |
||
155 | * Language relationship. |
||
156 | * |
||
157 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
158 | */ |
||
159 | public function language() |
||
165 | } |
||
166 |