__('Normal'), 'hidden' => __('Hidden')]; } public function getSourceList() { return ['manual' => __('Manual'), 'ai' => __('Ai'), 'system' => __('System'), 'market' => __('Market')]; } public function getLicenseTypeList() { return [ 'self' => __('Self'), 'system_copy' => __('System_copy'), 'market_single' => __('Market_single'), 'market_buyout' => __('Market_buyout'), ]; } public function factory() { return $this->belongsTo('Factory', 'factory_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function getLockedTimeTextAttr($value, $data) { $value = $value ?: ($data['locked_time'] ?? ''); return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; } public function getStatusTextAttr($value, $data) { $value = $value ?: ($data['status'] ?? ''); $list = $this->getStatusList(); return $list[$value] ?? ''; } protected function setLockedTimeAttr($value) { return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); } }