| Total Complexity | 1 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class UsageModel extends Model |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * 2. Set the static attribute $primary_key in your model |
||
| 15 | * - This is an string |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | static $table_name = 'chave_composta'; |
||
| 19 | /** |
||
| 20 | * 3. Set the static attribute $table_name in your model |
||
| 21 | * @var This is an string |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | static $primary_key = 'id'; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Query Example |
||
| 28 | * |
||
| 29 | * 5. For get all data using not static method query in model, but this needed the method is instantiated in model |
||
| 30 | * @var query |
||
| 31 | * @return Array with object if exists the data |
||
| 32 | * @return Array haven't data |
||
| 33 | */ |
||
| 34 | public function useQuery(){ |
||
| 35 | return $this->query('SELECT * FROM '.static::$table_name); |
||
| 36 | } |
||
| 40 |