定制 gkermer/nova-text-auto-complete 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

gkermer/nova-text-auto-complete

最新稳定版本:0.0.5

Composer 安装命令:

composer require gkermer/nova-text-auto-complete

包简介

A Laravel Nova text autocomplete field.

README 文档

README

This Nova field provides a capability of auto-completed searching for results inside a text input field.

Nova text with autocomplete demo

Installation

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

composer require gkermer/nova-text-auto-complete

Usage

To add an autocomplete text field, use the Gkermer\TextAutoComplete\TextAutoComplete field in your Nova resource:

use Gkermer\TextAutoComplete\TextAutoComplete;
TextAutoComplete::make('Favourite Fruit')->items([
    'Apple',
    'Apricots',
    'Avocado',
    'Banana',
    'Blueberries',
]),

Assuming you have an Eloquent model Fruit with attribute name, you could get the items by:

TextAutoComplete::make('Favourite Fruit')->items(
    Fruit::pluck('name')
),

However, imagine the Fruit has hundreds or thousands records and the drop-down selection menu is populated with so many items. Then you could find the items like so:

TextAutoComplete::make('Favourite Fruit')->items(function($search) {
    return Fruit::where('name', 'like', '%' . $search . '%')
        ->get()
        ->pluck('name');
}),

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 114.62k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 22
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 22
  • Watchers: 2
  • Forks: 10
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-14