__('Business_type 1')]; } public function getPurchaseTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['purchase_time']) ? $data['purchase_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getBusinessTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['business_type']) ? $data['business_type'] : ''); $list = $this->getBusinessTypeList(); return isset($list[$value]) ? $list[$value] : ''; } protected function setPurchaseTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function getGoodsList(){ return (new Goods())->where(['status'=>1])->select(); } public function getStoresList(){ return (new Stores())->where(['status'=>1])->select(); } public function admin() { return $this->belongsTo('app\admin\model\Admin', 'preparation_id', 'id', [], 'LEFT')->setEagerlyType(0); } }