| @@ 14-39 (lines=26) @@ | ||
| 11 | ||
| 12 | namespace Ecommerce\Item\Option; |
|
| 13 | ||
| 14 | class Item extends \Model |
|
| 15 | { |
|
| 16 | public static $objectName = 'Элемент коллекции опции'; |
|
| 17 | public static $cols = [ |
|
| 18 | //Основные параметры |
|
| 19 | 'item_option_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'option'], |
|
| 20 | 'value' => ['type' => 'text'], |
|
| 21 | //Системные |
|
| 22 | 'weight' => ['type' => 'number'], |
|
| 23 | 'date_create' => ['type' => 'dateTime'] |
|
| 24 | ]; |
|
| 25 | public static $labels = [ |
|
| 26 | 'value' => 'Значение' |
|
| 27 | ]; |
|
| 28 | ||
| 29 | public static function relations() |
|
| 30 | { |
|
| 31 | return [ |
|
| 32 | 'option' => [ |
|
| 33 | 'model' => 'Ecommerce\Item\Option', |
|
| 34 | 'col' => 'item_option_id' |
|
| 35 | ] |
|
| 36 | ]; |
|
| 37 | } |
|
| 38 | ||
| 39 | } |
|
| 40 | ||
| @@ 14-34 (lines=21) @@ | ||
| 11 | ||
| 12 | namespace Users; |
|
| 13 | ||
| 14 | class Session extends \Model |
|
| 15 | { |
|
| 16 | public static $cols = [ |
|
| 17 | 'hash' => ['type' => 'text'], |
|
| 18 | 'ip' => ['type' => 'text'], |
|
| 19 | 'agent' => ['type' => 'text'], |
|
| 20 | 'user_id' => ['type' => 'select', 'source' => 'realtion', 'relation' => 'user'], |
|
| 21 | 'date_create' => ['type' => 'dateTime'] |
|
| 22 | ]; |
|
| 23 | ||
| 24 | public static function relations() |
|
| 25 | { |
|
| 26 | return [ |
|
| 27 | 'user' => [ |
|
| 28 | 'model' => '\Users\User', |
|
| 29 | 'col' => 'user_id' |
|
| 30 | ] |
|
| 31 | ]; |
|
| 32 | } |
|
| 33 | ||
| 34 | } |
|
| 35 | ||