| 1 | <?php |
||
| 11 | trait ModelTrait |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Columns that will be displayed. |
||
| 15 | * If not set, it will get the columns from the database table. |
||
| 16 | * |
||
| 17 | * @var array |
||
| 18 | */ |
||
| 19 | protected $columns = []; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Columns that will be hidden in the display. |
||
| 23 | * If not set, it will hide a "password" column if it exists. |
||
| 24 | * |
||
| 25 | * @var array |
||
| 26 | */ |
||
| 27 | protected $hidden = [ 'password' ]; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Model's default primary key or unique identifier. |
||
| 31 | * |
||
| 32 | * @var string |
||
| 33 | */ |
||
| 34 | protected $primary_key = 'id'; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * The table associated with the model. |
||
| 38 | * |
||
| 39 | * @var string |
||
| 40 | */ |
||
| 41 | protected $table = ''; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Gets the specified primary key of the model. |
||
| 45 | * |
||
| 46 | * @return string |
||
| 47 | */ |
||
| 48 | public function getPrimaryKey() |
||
| 49 | { |
||
| 50 | return $this->primary_key; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Returns the values from the model's properties. |
||
| 55 | * |
||
| 56 | * @return array |
||
| 57 | */ |
||
| 58 | 18 | public function getProperties() |
|
| 67 | |||
| 68 | /** |
||
| 69 | * Gets the specified table name of the model. |
||
| 70 | * |
||
| 71 | * @return string |
||
| 72 | */ |
||
| 73 | 21 | public function getTableName() |
|
| 81 | } |
||
| 82 |