michalkortas/laravel-options-creator

Wrapper that helps create options at select element dynamically

Installs: 50

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:laravel-library

v1.0.12 2020-12-06 20:57 UTC

This package is auto-updated.

Last update: 2024-11-07 06:19:05 UTC


README

Wrapper that helps create options at select element dynamically

Installation

Warning! This component use Bootstrap Modal!

composer require michalkortas/laravel-options-creator
php artisan vendor:publish --tag=optionscreator --force

Usage

Add new stacks before end of tag.

<body>
  ...
  @stack('scripts')
  @stack('optionscreator')
</body>

Wrap your select with new tag. You can use some parameters to configure modal.

  <x-optionscreator-select
      url="{{route('store.api.route')}}"
      component="components.subEditForm"
      successValueKey="id"
      successTextKey="name"
      title="New option"
      saveButtonTitle="Create new option"
      loadingText="Please wait..."
      successText="<strong>New option has beed added</strong> to your select tag."
      errorText="<strong>Error occurred</strong>. Check console log."
      setNewValue="1">

      <select name="mySelect">
        <option>Select value</option>
      </select>
  </x-optionscreator-select>

This component will do the rest.