weizong song 1 year ago
parent 8bfd67a10c
commit de780c9bbc

@ -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;
}
}

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateProjectAddWechatpayAccountId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table("project", function (Blueprint $table) {
$table->integer('wechatpay_account_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
Loading…
Cancel
Save