承接 devhereco/livewire-delete-confirmation 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

devhereco/livewire-delete-confirmation

最新稳定版本:1.0

Composer 安装命令:

composer require devhereco/livewire-delete-confirmation

包简介

A Laravel package for easily handling the deletion of Eloquent models with confirmation and success/error messaging.

README 文档

README

Livewire Confirm Delete is a Laravel package that simplifies the process of confirming and deleting Eloquent model records with ease. It seamlessly integrates with the Livewire framework and provides a convenient way to handle model deletion while displaying confirmation dialogs and success/error messages.

Installation

To get started with Livewire Confirm Delete, you can install it via Composer:

composer require devhereco/livewire-delete-confirmation

Package Dependencies

Please make sure to include the following package dependencies in your Laravel project as they are required for Livewire Confirm Delete to work:

  1. jantinnerezo/livewire-alert ^3
  2. livewire/livewire ^3

Usage

  1. Create a Livewire Component: that extends ConfirmDeleteComponent. You can define the Eloquent model you want to work with and customize your component as needed. For example:
<?php

namespace App\Livewire;

use devhereco\LivewireConfirmDelete\ConfirmDeleteComponent;

class ProductComponent extends ConfirmDeleteComponent
{
    protected $model = Product::class;

    public function render()
    {
        return view('livewire.product-component');
    }
}
  1. Configure Your Blade View: In your Blade view for the Livewire component, you can display your model records and add a button or trigger that calls the destroy method from ConfirmDeleteComponent. Here's an example of how you can do this:
<!-- Displaying Model Records -->
@foreach ($products as $product)
    <div class="product">
        <h2>{{ $product->name }}</h2>
        <!-- Add a Delete Button -->
        <button wire:click="destroy({{ $product->id }})">Delete</button>
    </div>
@endforeach

In this example, we loop through a collection of products and display them. For each product, a "Delete" button is added with a Livewire click event to trigger the destroy method with the product's ID as a parameter. When the button is clicked, the confirmation dialog will appear.

  1. Confirmation Dialog: When you call the destroy method, a confirmation dialog will appear, prompting the user to confirm the deletion.
  2. Success/Error Messages: After the deletion process is completed, Livewire Confirm Delete provides success and error messages, giving feedback to the user.

License

This package is open-sourced software licensed under the MIT License.

Credits

Livewire Confirm Delete is developed and maintained by Mohammed B. Copyright ©2023 Development Here.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-23