__('Status offline'), 'online' => __('Status online'), 'busy' => __('Status busy')]; } public function getLasttimeTextAttr($value, $data) { $value = $value ? $value : (isset($data['lasttime']) ? $data['lasttime'] : ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } protected function setLasttimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } public function admin () { return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id')->field('id,username,nickname,avatar'); } }