- UserController.php
$form = Lego::form(new User());
$form->addText('number', '编号')->required()->rule('numeric')->unique();
$form->addText('email', '邮箱')->required()->rule('email')->unique();
return $form->view('layout', ['form' => $form]);
- layout.blade.php
<!doctype html>
<html lang="en">
<head>
@include('lego::styles')
</head>
<body>
{!! $form !!}
@include('lego::scripts')
</body>
</html>
- Just works!
composer require "wutongwan/lego"
php artisan vendor:publish --tag=lego-assets --force
Tips:
Add this command to
post-update-cmd
, In order to update lego static files Automatically.