diff --git a/app/Forms/ProjectForm.php b/app/Forms/ProjectForm.php index 503192a..d43a7ef 100755 --- a/app/Forms/ProjectForm.php +++ b/app/Forms/ProjectForm.php @@ -2,6 +2,7 @@ namespace App\Forms; +use App\Models\WechatpayAccount; use Kris\LaravelFormBuilder\Form; use Kris\LaravelFormBuilder\Field; @@ -13,6 +14,7 @@ class ProjectForm extends Form $this->add("longitude", Field::HIDDEN); $this->add("name", Field::TEXT, ["label" => "名称", "rules" => "required"]); $this->add("address", Field::TEXT, ["label" => "地址", "rules" => "required"]); + $this->add("wechatpay_account_id", Field::SELECT, ["label" => "微信支付账号", "choices" => $this->getWechatpayAccount()]); $this->add("percent_first_party", Field::NUMBER, ["label" => "院方结算百分比"]); $this->add("logo", Field::TEXT, ["label" => "logo", "attr" => ["data-plugin" => "uploader"]]); $this->add("banners", Field::TEXT, ["label" => "banner", "attr" => ["data-plugin" => "uploader", "data-multiple-multiple" => 1]]); @@ -37,4 +39,14 @@ class ProjectForm extends Form ["label" => "返回", "attr" => ["class" => "btn btn-light btn-back", "type" => "button"]] ]]); } + + function getWechatpayAccount() + { + $rows = (new WechatpayAccount())->get(); + $res = []; + foreach ($rows as $row) { + $res["{$row->id}"] = $row->name."({$row->mchid})"; + } + return $res; + } } diff --git a/database/migrations/2024_12_29_210453_update_project_add_wechatpay_account_id.php b/database/migrations/2024_12_29_210453_update_project_add_wechatpay_account_id.php new file mode 100644 index 0000000..6640011 --- /dev/null +++ b/database/migrations/2024_12_29_210453_update_project_add_wechatpay_account_id.php @@ -0,0 +1,30 @@ +integer('wechatpay_account_id')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +}