梧桐玩/乐高

为 Laravel 提供另一个 CRUD 小部件

1.0-beta.12 2020-09-14 07:46 UTC

This package is auto-updated.

Last update: 2024-09-06 17:01:08 UTC


README

tests Latest Stable Version Total Downloads

注意:乐高尚处于开发阶段,在1.0版本发布之前主要接口仍有调整的可能性,请注意查看 release note !

示例

  • 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>
    <title>Lego Form</title>
    @include('lego::styles')
</head>
<body>
    {!! $form !!}
    @include('lego::scripts')
</body>
</html>

image

要求

  • php >= 7.1
  • Laravel >= 6.0

安装

1、Composer

composer require wutongwan/lego

2、发布 lego 资产

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

提示

为了保持资产更新并避免未来更新中的问题,您可以将命令添加到 composer.json 文件中的 post-update-cmd 脚本中

{
     "scripts": {
         "post-update-cmd": [
             "@php artisan vendor:publish --tag=lego-assets --force"
         ]
     }
 }

文档

开发

  • 分支

    • master, 在 master 下开发及维护
  • 当前版本在以下环境中开发并维护

    • Mac
    • Ubuntu
  • 运行演示

    php demo/run.php [--host=127.0.0.1] [--port=8080]

原因

使用了近一年的zofe/rapyd-laravel,整体觉得非常好用,但内部确实不少代码年久失修,比较乱,有的组件也不适合中国的情况(比如google map)。

所以我们几个小伙伴想了很久,还是决定重新造个轮子,参考rapyd的思路,做一个我们自己用着更顺手的脚手架库。

取名乐高,也是向乐高致敬,能用简单的块搭建摩天大楼是我们的梦想。

现在整体代码还是非常初级的版本,有兴趣的朋友欢迎关注以及和我们讨论,但由于整个项目是以提高团队自身效率为最优先前提的,可能我们会独断一些,不会刻意的做的太通用。