Laravel Lego, Save you from CRUD.

Demo

Usage

$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]);
<!doctype html>
<html lang="en">
<head>
    @include('lego::styles')
</head>
<body>

    {!! $form !!}

    @include('lego::scripts')
</body>
</html>

form

Install

1、Dependency

composer require "wutongwan/lego"

2、Publish lego assets

php artisan vendor:publish --tag=lego-assets --force

Tips:

Add this command to post-update-cmd, In order to update lego static files Automatically.

Documents