You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
1.1 KiB

5 years ago
<?php
namespace App\Forms;
3 years ago
use App\Models\Project;
5 years ago
use Kris\LaravelFormBuilder\Form;
use Kris\LaravelFormBuilder\Field;
class AdminForm extends Form
{
public function buildForm()
{
$this->add("name", Field::TEXT, ["label" => "姓名", "rules" => "required"]);
$this->add("username", Field::TEXT, ["label" => "用户名", "rules" => "required", "attr" => ["autocomplete" => "off"]]);
$this->add("password", Field::PASSWORD, ["label" => "密码", "rules" => "min:6", "value" => "", "attr" => ["autocomplete" => "off"]]);
3 years ago
$this->add("project_id", Field::SELECT, ["label" => "管辖项目/医院", "rules" => "required", "attr" => ["multiple" => true, "data-plugin" => "select2"], "choices" => (new Project())->get()->pluck("name", "id")->toArray()]);
5 years ago
$this->add('buttons', 'buttongroup', ["splitted" => true, "buttons" => [
["label" => "保存", "attr" => ["class" => "btn btn-primary mr-1", "type" => "submit"]],
["label" => "返回", "attr" => ["class" => "btn btn-light btn-back", "type" => "button"]]
]]);
}
}