| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace App\Module\Promotion\AdminControllers\Helper;
- use App\Module\Promotion\Enums\PROFIT_SOURCE_TYPE;
- use App\Module\Promotion\Enums\REFERRAL_CHANGE_REASON;
- use App\Module\Promotion\Enums\REFERRAL_CODE_STATUS;
- use App\Module\Promotion\Enums\REFERRAL_CODE_USAGE_STATUS;
- /**
- * 表单页辅助特性
- *
- * 提供表单页的辅助方法,如表单项的显示、格式化等。
- */
- trait FormHelperTrait
- {
- /**
- * 推荐码状态选择
- *
- * @param string $field 字段名
- * @param string $label 标签
- * @return \Dcat\Admin\Form\Field\Select
- */
- public function selectReferralCodeStatus(string $field = 'status', string $label = '状态')
- {
- return $this->form->select($field, $label)->options(REFERRAL_CODE_STATUS::getOptions());
- }
- /**
- * 推荐码使用状态选择
- *
- * @param string $field 字段名
- * @param string $label 标签
- * @return \Dcat\Admin\Form\Field\Select
- */
- public function selectReferralCodeUsageStatus(string $field = 'status', string $label = '状态')
- {
- return $this->form->select($field, $label)->options(REFERRAL_CODE_USAGE_STATUS::getOptions());
- }
- /**
- * 推荐关系修改原因选择
- *
- * @param string $field 字段名
- * @param string $label 标签
- * @return \Dcat\Admin\Form\Field\Select
- */
- public function selectReferralChangeReason(string $field = 'reason', string $label = '修改原因')
- {
- return $this->form->select($field, $label)->options(REFERRAL_CHANGE_REASON::getOptions());
- }
- /**
- * 收益来源类型选择
- *
- * @param string $field 字段名
- * @param string $label 标签
- * @return \Dcat\Admin\Form\Field\Select
- */
- public function selectProfitSourceType(string $field = 'source_type', string $label = '来源类型')
- {
- return $this->form->select($field, $label)->options(PROFIT_SOURCE_TYPE::getOptions());
- }
- /**
- * JSON编辑器
- *
- * @param string $field 字段名
- * @param string $label 标签
- * @return \Dcat\Admin\Form\Field\Editor
- */
- public function jsonEditor(string $field, string $label)
- {
- return $this->form->editor($field, $label)->language('json');
- }
- }
|