All Projects → techouse → select-auto-complete

techouse / select-auto-complete

Licence: MIT license
An auto-completing Laravel Nova search field

Programming Languages

Vue
7211 projects
javascript
184084 projects - #8 most used programming language
PHP
23972 projects - #3 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to select-auto-complete

nova-settings
A tool for editing settings on your project using akaunting/setting package on Laravel Nova
Stars: ✭ 18 (-47.06%)
Mutual labels:  laravel-nova
nova-assertions
Laravel Nova assertions for your tests
Stars: ✭ 76 (+123.53%)
Mutual labels:  laravel-nova
nova-system-resources
Display the system usage in Laravel-Nova
Stars: ✭ 30 (-11.76%)
Mutual labels:  laravel-nova
Lang
List of 78 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.
Stars: ✭ 6,285 (+18385.29%)
Mutual labels:  laravel-nova
nova-list-card
Add a variety of resource lists to Nova dashboards
Stars: ✭ 39 (+14.71%)
Mutual labels:  laravel-nova
nova-table-field
Table field for Laravel Nova
Stars: ✭ 29 (-14.71%)
Mutual labels:  laravel-nova
nova-translatable
Nova Field for spatie/laravel-translatable package.
Stars: ✭ 84 (+147.06%)
Mutual labels:  laravel-nova
nova-html
This field allows you display custom HTML in Laravel Nova, be it a link, an image or any other piece of proper html.
Stars: ✭ 13 (-61.76%)
Mutual labels:  laravel-nova
nova-conditional-fields
WIP: Conditionally display fields based on another field's value
Stars: ✭ 38 (+11.76%)
Mutual labels:  laravel-nova
nova-blogify-tool
Create a simple blog in a few seconds. Powered by Laravel Nova.
Stars: ✭ 20 (-41.18%)
Mutual labels:  laravel-nova
nova-errors
Display all form errors in a modal at the top of the page.
Stars: ✭ 16 (-52.94%)
Mutual labels:  laravel-nova
nova-gridder
Customize Nova Resource Details using Tailwind Grid System and more
Stars: ✭ 18 (-47.06%)
Mutual labels:  laravel-nova
nova-dynamic-field
Dynamic field for Laravel Nova
Stars: ✭ 18 (-47.06%)
Mutual labels:  laravel-nova
nova-hidden-field
A Laravel Nova Hidden field.
Stars: ✭ 32 (-5.88%)
Mutual labels:  laravel-nova
nova-sluggable
Slug field for Laravel Nova
Stars: ✭ 40 (+17.65%)
Mutual labels:  laravel-nova
laravel-nova-visual-composer
Visual Composer for Laravel Nova
Stars: ✭ 15 (-55.88%)
Mutual labels:  laravel-nova
nova-opcache
OPcache Tool for Laravel Nova
Stars: ✭ 21 (-38.24%)
Mutual labels:  laravel-nova
nova-horizon-stats
Nova cards for Laravel applications that use Laravel Horizon
Stars: ✭ 31 (-8.82%)
Mutual labels:  laravel-nova
laravel-nova-order-nestedset-field
Laravel Nova field that make your resources orderable
Stars: ✭ 21 (-38.24%)
Mutual labels:  laravel-nova
nova-qrcode-field
A Laravel Nova field to generate QR Code
Stars: ✭ 28 (-17.65%)
Mutual labels:  laravel-nova

Select Auto-Complete

Latest Version on Packagist Total Downloads Licence PHP version Codacy Badge GitHub stars

An auto-completing Laravel Nova search field.

Provides a capability of auto-completed searching for results inside a select input field.

Select Auto-Complete

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require techouse/select-auto-complete

Usage

The API is extends Nova's default Select Field by adding these additional options:

  • default - OPTIONAL - Set the default value in case of an empty field. Default is null.
  • maxResults - OPTIONAL - Number of results to show at a time. Has to be a positive integer. Default is 30.
  • maxHeight - OPTIONAL - Height of select dropdown list. Default is 220px.
  • displayUsingLabels - OPTIONAL - List only the labels of the options list. Default is disabled and displays keys and labels.
  • placeholder - OPTIONAL - Use a custom placeholder.

Simply use SelectAutoComplete class instead of Select directly or alias it like the example below so you won't have to refactor too much existing code.

<?php

namespace App\Nova\Actions;

use App\AccountData;
use Illuminate\Bus\Queueable;
use Laravel\Nova\Actions\Action;
use Illuminate\Support\Collection;
use Laravel\Nova\Fields\ActionFields;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Techouse\SelectAutoComplete\SelectAutoComplete as Select;

class EmailAccountProfile extends Action
{
    use InteractsWithQueue, Queueable, SerializesModels;

    /**
     * Perform the action on the given models.
     *
     * @param  \Laravel\Nova\Fields\ActionFields  $fields
     * @param  \Illuminate\Support\Collection  $models
     * @return mixed
     */
    public function handle(ActionFields $fields, Collection $models)
    {
        foreach ($models as $model) {
            (new AccountData($model))->send();
        }
    }

    /**
     * Get the fields available on the action.
     *
     * @return array
     */
    public function fields()
    {
        return [
            Select::make(__('Person'), 'person')
                  ->options(\App\Person::all()->mapWithKeys(function ($person) {
                      return [$person->id => $person->name];
                  }))
                  ->displayUsingLabels(),
                  
            Select::make(__('Partner'), 'partner')
                  ->options(\App\User::all()->pluck('name', 'id'))
                  ->placeholder('Pick a name') // use a custom placeholder
                  ->displayUsingLabels()       // display only the labels od the options list
                  ->default(7)                 // set the default to the User with the ID 7
                  ->maxResults(5)              // limit the dropdown select to a max of 5 hits
                  ->maxHeight('100px')         // limit the dropdown to a max height of 100px
                  ->required()                 // make the field required
        ];
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].