承接 markrefaat/livewire-modal 相关项目开发

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

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

markrefaat/livewire-modal

最新稳定版本:0.0.1

Composer 安装命令:

composer require markrefaat/livewire-modal

包简介

Livewire Modal

README 文档

README

Screenshots

Package Gif

Requirements

Installation

  composer require markrefaat/livewire-modal

Usage/Examples

<?php

namespace App\Http\Livewire;

use Markrefaat\LivewireModal\LivewireModal;
use Markrefaat\LivewireModal\LivewireModalField;

class UserModal extends LivewireModal
{
    public $user;
    public $age;
    public $selectedUser;

    public function setUp()
    {
        $this->setModalId("userModal")
            ->setModalTitle("Create User")
            ->setOnOpenModalFunction("create")
            ->setModalType("formModal")
            ->setSubmitButtonText("Save")
            ->setSubmitButtonFunction("save");
    }

    public function getFieldsProperty()
    {
        return [
            LivewireModalField::type('dropdown')
                ->label('Users List')
                ->required(true)
                ->varName('selectedUser')
                ->options('users')
                ->optionValue('id')
                ->optionName('name'),
            LivewireModalField::type('text')
                ->label('Name')
                ->required(true)
                ->varName('user'),
            LivewireModalField::type('number')
                ->label('Age')
                ->varName('age'),
        ];
    }

    protected function rules()
    {
        return [
            'user' => ['required']
        ];
    }

    // Call on open modal
    public function create()
    {}

    // Call on submit form
    public function save()
    {}
}
<livewire:user-modal />
<a data-bs-toggle="modal" data-bs-target="#userModal" class="btn btn-primary" 
onclick="window.livewire.emit('userModal')">Open User Modal</a>

Documentation

1. setUp Function

Example

public function setUp()
    {
        $this->setModalId("tempModal")
            ->setModalTitle("Modal Title")
            ->setOnOpenModalFunction("create")
            ->setModalType("formModal")
            ->setSubmitButtonText("Save")
            ->setSubmitButtonFunction("save");
    }

setModalId( Model Id to trigger open modal )

setModalTitle( "Modal displayed title" )

setOnOpenModalFunction( "On modal open function name" )

setModalType( (formModal, confirmationModal) )

setShowCloseButton( (true, false) "By default true". ) OPTIONAL: Show/Hide close button on the left of submit button

setShowCloseIcon( (true, false) "By default true". ) OPTIONAL: Show/Hide close icon on the right of the title

If you choose "formModal" model type

setSubmitButtonText( "Submit button displayed text" )

setSubmitButtonFunction( "Submit button function name" )

If you choose "confirmationModal" model type

setConfirmButtonFunction( "Confirm button function name" )

setConfirmButtonText( "Confirm button displayed text" )

setConfirmMessage( "Confirmation .essage" )

2. getFieldsProperty Function (If you choose "formModal" model type)

return List of LivewireModalField.

3. getOptionsListProperty Function (If you choose "formModal" model type)

Example

public function getOptionsListProperty()
    {
        return [
            'users' => User::get(),
        ];
    }

4. LivewireModalField (If you choose "formModal" model type)

type: Input Types (checkbox, date, datetime-local, email, file, number, password, text, textarea, dropdown).

varName: PHP variable linked to the input "wire:model".

label OPTIONAL : Label above input.

placeholder OPTIONAL: Input placeholder.

required OPTIONAL: Show * in label and placeholder (true, false) "By default false".

disabled OPTIONAL: (true, false) "By default false".

class OPTIONAL: Bootstrap classes for input "By default col-12".

If you choose dropdown type:

options: The key from the list getOptionsListProperty().

optionName: The displayed value of the dropdown "ed. name".

optionValue: The actual value of the dropdown "ex. id".

optionMulti OPTIONAL: The max number of items the user can select.

defer OPTIONAL: "wire:model.defer" (true, false) "By default true".

5. Helper Functions

$this->closeModal();

$this->resetModal();

$this->resetModalExcept(['user', 'age']);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固