1 | <?php namespace Arcanedev\LaravelTracker\Models; |
||
33 | class VisitorActivity extends AbstractModel implements VisitorActivityContract |
||
34 | { |
||
35 | /* ------------------------------------------------------------------------------------------------ |
||
36 | | Properties |
||
37 | | ------------------------------------------------------------------------------------------------ |
||
38 | */ |
||
39 | /** |
||
40 | * The table associated with the model. |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $table = 'visitor_activities'; |
||
45 | |||
46 | /** |
||
47 | * The attributes that are mass assignable. |
||
48 | * |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $fillable = [ |
||
52 | 'visitor_id', |
||
53 | 'path_id', |
||
54 | 'query_id', |
||
55 | 'referrer_id', |
||
56 | 'method', |
||
57 | 'route_path_id', |
||
58 | 'is_ajax', |
||
59 | 'is_secure', |
||
60 | 'is_json', |
||
61 | 'wants_json', |
||
62 | 'error_id', |
||
63 | ]; |
||
64 | |||
65 | /** |
||
66 | * The attributes that should be cast to native types. |
||
67 | * |
||
68 | * @var array |
||
69 | */ |
||
70 | protected $casts = [ |
||
71 | 'id' => 'integer', |
||
72 | 'visitor_id' => 'integer', |
||
73 | 'path_id' => 'integer', |
||
74 | 'query_id' => 'integer', |
||
75 | 'referrer_id' => 'integer', |
||
76 | 'route_path_id' => 'integer', |
||
77 | 'is_ajax' => 'boolean', |
||
78 | 'is_secure' => 'boolean', |
||
79 | 'is_json' => 'boolean', |
||
80 | 'wants_json' => 'boolean', |
||
81 | 'error_id' => 'integer', |
||
82 | ]; |
||
83 | |||
84 | /* ------------------------------------------------------------------------------------------------ |
||
85 | | Relationships |
||
86 | | ------------------------------------------------------------------------------------------------ |
||
87 | */ |
||
88 | /** |
||
89 | * Visitor relationship. |
||
90 | * |
||
91 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
92 | */ |
||
93 | public function visitor() |
||
94 | { |
||
95 | return $this->belongsTo( |
||
96 | $this->getModelClass(BindingManager::MODEL_VISITOR, Visitor::class) |
||
97 | ); |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * Path relationship. |
||
102 | * |
||
103 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
104 | */ |
||
105 | public function path() |
||
111 | |||
112 | /** |
||
113 | * Query relationship. |
||
114 | * |
||
115 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
116 | */ |
||
117 | public function queryRel() |
||
123 | |||
124 | /** |
||
125 | * Referrer relationship. |
||
126 | * |
||
127 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
128 | */ |
||
129 | public function referrer() |
||
135 | |||
136 | /** |
||
137 | * Error relationship. |
||
138 | * |
||
139 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
140 | */ |
||
141 | public function error() |
||
147 | |||
148 | /* ------------------------------------------------------------------------------------------------ |
||
149 | | Check Functions |
||
150 | | ------------------------------------------------------------------------------------------------ |
||
151 | */ |
||
152 | /** |
||
153 | * Check if the referer exists. |
||
154 | * |
||
155 | * @return bool |
||
156 | */ |
||
157 | public function hasReferer() |
||
161 | } |
||
162 |