| 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 | * Returns the specified columns of the model. |
||
| 45 | * |
||
| 46 | * @return array |
||
| 47 | */ |
||
| 48 | 12 | public function getColumns() |
|
| 52 | |||
| 53 | /** |
||
| 54 | * Returns the specified hidden columns of the model. |
||
| 55 | * |
||
| 56 | * @return array |
||
| 57 | */ |
||
| 58 | 12 | public function getHiddenColumns() |
|
| 62 | |||
| 63 | /** |
||
| 64 | * Gets the specified primary key of the model. |
||
| 65 | * |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | 3 | public function getPrimaryKey() |
|
| 72 | |||
| 73 | /** |
||
| 74 | * Gets the specified table name of the model. |
||
| 75 | * |
||
| 76 | * @return string |
||
| 77 | */ |
||
| 78 | 15 | public function getTableName() |
|
| 86 | } |
||
| 87 |