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