libaro/bread

Bread

1.5.3 2022-07-29 13:58 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

什么是 Bread?

Bread 代表浏览、读取、编辑、添加和删除。它允许开发者通过描述使用哪些字段来快速创建 CRUD 应用程序。

完整文档安装在 /docs 目录下

Bread 是一个 Laravel 包,可与 Inertia、Tailwind 和 Vue 一起使用。所以请确保已安装并配置了这些。

安装

composer require libaro/bread

发布资源文件

运行以下命令以发布渲染索引和表单页面所需的 JavaScript 文件。

php artisan vendor:publish --tag=bread --force

这将向您的项目添加以下内容

/Bread
  /Resources
    /js 
    /ui

您可以在 Bread/Resources 目录中自定义发布的文件并添加自己的组件。

更新您的 inertia 应用

更新您的 inertia 应用以包含以下内容

createInertiaApp({
  resolve: (name) => {
    const [domain, path] = name.split('::')

    let page = null

    if (domain === 'Bread') {
      page = require(`./../../../Bread/Resources/ui/Pages/${path}.vue`).default
    } else {
      page = require(`./../../../resources/admin/ui/Pages/${domain}/${path}.vue`).default
    }

    page.layout ??= Backend

    return page
  },
  ...
})

这允许在调用 Inertia 页面时使用 {domain}::{page}(例如:Bread::Index)。

将 '@bread' 别名添加到您的 webpack 配置文件中

const path = require('path')

module.exports = {
  optimization: {
    minimize: false,
  },
  resolve: {
    alias: {
      '@bread': path.resolve('Bread/Resources')
    }
  }
}

依赖关系

Bread 需要以下依赖项,请确保在项目中安装这些

npm install -D tailwindcss@^3.1 postcss autoprefixer vue@^3.2 @inertiajs/inertia@^0.11.0 @inertiajs/inertia-vue3@^0.6.0 unplugin-vue-define-options@^0.6.1 @tailwindcss/forms@^0.4.0 @headlessui/vue@^1.6 pinia@^2.0.0 uuid@^8.3.2 luxon@^2.4.0
composer require tightenco/ziggy

测试

composer test

变更日志

请参阅 变更日志 了解最近更改的更多信息。

贡献

请参阅 贡献指南 了解详情。

开发流程

请参阅 开发流程 了解详情。

安全漏洞

请查阅 我们的安全策略 了解如何报告安全漏洞。

鸣谢

许可协议

MIT 许可协议(MIT)。请参阅 许可文件 了解更多信息。