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

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

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

chrishenrique/livewire-modal-crud

最新稳定版本:v1.1

Composer 安装命令:

composer require chrishenrique/livewire-modal-crud

包简介

Livewire Modals Crud easy

README 文档

README

This package provides a simple structure to implement CRUD operations (Create, Read, Update, Delete) using modals with Livewire in Laravel. It's ideal for applications that need a dynamic and interactive interface without page reloads.

✨ Features

  • Ready-to-use Livewire components with modal support
  • Tailwind CSS integration for responsive styling
  • Code organization following Laravel best practices
  • Easy customization and extensibility

🚀 Installation

To install the package via Composer, run:

composer require chrishenrique/livewire-modal-crud

After installation, publish the files with the commands below:

php artisan vendor:publish --tag=modal-config
php artisan vendor:publish --tag=modal-js
php artisan vendor:publish --tag=modal-views

⚙️ Setup

Make sure Livewire is installed in your project. If not, install it with:

composer require livewire/livewire

Include Livewire styles and scripts in your Blade layout:

<head>
    ...
    @livewireStyles
</head>
<body>
    ...
    @livewireScripts
</body>

🧩 Usage

Include the modal component once in your layout (usually in your main Blade view):

@livewire('modal')

Opening a modal

To open a modal dynamically, use:

<button class="btn btn-primary"
    onclick="Livewire.dispatchTo('modal', 'openModal', {
        component: 'modals.users-form',
        arguments: {
            mode: 'create',
        }
    })"
> New </button>

Modes

The default accepted values for the mode argument are:

  • 'create'
  • 'edit'
  • 'delete'
  • 'show'

However, you can use any custom string value according to your app logic.

Passing id for model binding

To open a modal with a specific model instance, just include the id parameter:

<button class="btn btn-primary mx-1"
    onclick="Livewire.dispatchTo('modal', 'openModal', {
        component: 'modals.users-form',
        arguments: {
            mode: 'edit',
            id: {{ $user->id }},
        }
    })"
> Edit </button>

📝 License

This project is licensed under the MIT License. See the LICENSE file for more details.

For help, suggestions, or contributions, visit the GitHub repository: chrishenrique/livewire-modal-crud

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-25