12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace app\model\activity\table;
- use crmeb\basic\BaseModel;
- use crmeb\traits\ModelTrait;
- use app\model\other\Category;
- use app\model\store\SystemStore;
- use app\model\activity\collage\UserCollageCode;
- class TableQrcode extends BaseModel
- {
- use ModelTrait;
-
- protected $pk = 'id';
-
- protected $name = 'table_qrcode';
-
- protected function getAddTimeAttr($value)
- {
- if ($value) return date('Y-m-d H:i:s', (int)$value);
- return '';
- }
-
- protected function getOrderTimeAttr($value)
- {
- if ($value) return date('m-d H:i', (int)$value);
- return '';
- }
-
- public function category()
- {
- return $this->hasOne(Category::class, 'id', 'cate_id')->where(['group' => 6, 'type' => 1])->field(['id', 'name']);
- }
-
- public function storeName()
- {
- return $this->hasOne(SystemStore::class, 'id', 'store_id')->field(['id','name as storeName']);
- }
-
- public function collateCode()
- {
- return $this->hasOne(UserCollageCode::class, 'qrcode_id', 'id')->field(['qrcode_id','serial_number','number_diners']);
- }
- }
|