PluginProbe
Depicter — Popup & Slider Builder / trunk
Depicter — Popup & Slider Builder vtrunk
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / Database / Entity / DocumentAnalytics.php

DocumentAnalytics.php in Depicter — Popup & Slider Builder trunk, at app/src/Database/Entity/DocumentAnalytics.php

57 lines 1007 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Depicter\Database\Entity;
3
4 use Averta\WordPress\Database\Entity\Model;
5
6 class DocumentAnalytics extends Model
7 {
8
9 protected $idColumn = 'id';
10
11 protected $idForeign = 'source_id';
12
13 /**
14 * Resource name.
15 *
16 * @var string
17 */
18 protected $resource = 'depicter_document_analytics';
19
20 /**
21 * Determines what fields can be saved without be explicitly.
22 *
23 * @var array
24 */
25 protected $builtin = [
26 'source_id',
27 'event_type',
28 'ip_address',
29 'user_id',
30 'session_id',
31 'created_at'
32 ];
33
34 protected $guard = [ 'id' ];
35
36 protected $format = [
37 'created_at' => 'currentDateTime'
38 ];
39
40 public function currentDateTime() {
41 return gmdate('Y-m-d H:i:s', time());
42 }
43
44 public function document(){
45 return $this->belongsTo(Document::class, 'source_id', 'id');
46 }
47
48 /**
49 * Retrieves related meta field models
50 *
51 * @return Meta|\TypeRocket\Models\Model|null
52 */
53 public function meta(){
54 return $this->hasMany(Meta::class, 'relation_id', $this->idColumn );
55 }
56 }
57