Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 539 Bytes

form.md

File metadata and controls

27 lines (19 loc) · 539 Bytes

Lego Form

Lego 中的表单组件

example code

$blog = Blog::find($blogId);

$form = Lego::form($blog);
$form->addText('title', 'Blog Title')->required();
$form->addTextarea('content')->required();
$form->addAutoComplete('author.name', 'Select Author')->required();
$form->addDatetime('created_at', 'Created At')->required();

return $form->view('layout', compact('form'));

自定义表单提交后的处理逻辑

$form->onSubmit(function (Form $form) {
	$form->field('xxx')->getNewValue();
	// ...
});