medrachy/crud-livewire 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

medrachy/crud-livewire

Composer 安装命令:

composer require medrachy/crud-livewire

包简介

Generate the CRUD livewire component for a model

README 文档

README

Generate the livewire class and view for a model using the fillable attributes or the database columns, by running one command and providing the table name as argument this package generate the files (class/view) with all CRUD functions

MIT License

Features

  • Use the model instance as public variable
  • Use Jetstream components
  • Create , Update and Delete using modals
  • Manage inputs and types directly from the livewire class
  • Paginations

Requirements

  • Laravel 8+
  • Jetstream with livewire stack

Installation

You can install the package via Composer

 composer require medrachy/crud-livewire

Usage

After installation, run this command

 php artisan crud:build {tableName}   //example : users

This command will perfom below actions :

  • generate the proper (className, modelName and viewName) from the tableName
  • create livewire directory if it doesn't exist "/app/Http/Livewire"
  • generate the livewire class "/app/Http/Livewire/{className}.php"
  • create livewire directory if it doesn't exist "/resources/views/livewire"
  • generate the livewire view "/resources/views/livewire/{viewName}.blade.php"

Next open the livewire class generated "/app/Http/Livewire/{className}.php" and add the proper properties for $rules and $inputTypes

// Add the input type for each attribute
public array $inputTypes = [
        // 'attribute' => 'inputType',
        // example :
        'name' => 'text',
        'email' => 'email',
];

// Add rules
protected $rules = [
    //  'modalName.attribute' => 'required',
    // example :
    'user.name' => 'required',
    'user.email' => 'required|email',
];

And thats it, now you can render you livewire component like so :

<div>@livewire('{viewName}') // example @livewire('user-crud)</div>

Jetstream

This package use Jetstream modal component, if you dont use Jetstream in your application you need to edit the view generated by this package.

License

The MIT License (MIT). Please see License File for more information

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固