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
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-25