__('Business_type 1'), '2' => __('Business_type 2'), '3' => __('Business_type 3'), '4' => __('Business_type 4')]; } public function getCustomersList(){ return (new Customers())->where(['status'=>1])->select(); } public function getBusinessTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['business_type']) ? $data['business_type'] : ''); $list = $this->getBusinessTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getBillTimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['bill_time']) ? $data['bill_time'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } protected function setBillTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function customers() { return $this->belongsTo('Customers', 'customers_id', 'id', [], 'LEFT')->setEagerlyType(0); } }