__('Store_type 1'), '2' => __('Store_type 2')]; } 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 getStoreTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['store_type']) ? $data['store_type'] : ''); $list = $this->getStoreTypeList(); return isset($list[$value]) ? $list[$value] : ''; } protected function setPurchaseTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function admin() { return $this->belongsTo('app\admin\model\Admin', 'admin_id', 'id', [], 'LEFT')->setEagerlyType(0); } }