PluginProbe
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce / 1.6.9
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce v1.6.9
1.17.9 1.17.8 1.17.7 1.17.6 1.17.5 1.17.4 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.3.0 1.3.1 1.3.11 1.3.12 1.3.13 1.3.14 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 All 143 releases
erp / includes / framework / Model.php

Model.php in ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce 1.6.9, at includes/framework/Model.php

65 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WeDevs\ERP\Framework;
4
5 /**
6 * Class Model
7 */
8 class Model extends \WeDevs\ORM\Eloquent\Model {
9 protected $prefixed_table = null;
10
11 /**
12 * Get the table name with WP prefix
13 *
14 * @return string
15 */
16 public function getTable() {
17 if ( ! $this->prefixed_table ) {
18 $this->prefixed_table = $this->getConnection()->db->prefix . $this->table;
19 }
20
21 return $this->prefixed_table;
22 }
23
24 /**
25 * Set the value of the "created at" attribute.
26 *
27 * @param mixed $value
28 *
29 * @return void
30 */
31 public function setCreatedAt( $value ) {
32 $this->{static::CREATED_AT} = current_time( 'mysql' );
33 }
34
35 /**
36 * Set the value of the "updated at" attribute.
37 *
38 * @param mixed $value
39 *
40 * @return void
41 */
42 public function setUpdatedAt( $value ) {
43 $this->{static::UPDATED_AT} = current_time( 'mysql' );
44 }
45
46 /**
47 * Set the table associated with the model.
48 *
49 * @param string $table
50 *
51 * @return $this
52 */
53 public function setTable( $table ) {
54 if ( ! empty( $this->table ) ) {
55 $table = $this->table;
56 }
57
58 if ( ! $this->prefixed_table ) {
59 $this->prefixed_table = $this->getConnection()->db->prefix . $table;
60 }
61
62 return $this;
63 }
64 }
65