illizian/nova-suggest-field-container
最新稳定版本:v0.1.1
Composer 安装命令:
composer require illizian/nova-suggest-field-container
包简介
A Laravel Nova field container allowing Textarea's to contain typeahead suggestions
README 文档
README
Description
A container for TextArea fields that enables typeahead auto suggestions
Demo
Installation
The package can be installed through Composer.
composer require illizian/nova-suggest-field-container
Usage
Wrap your TextArea with \Illizian\NovaSuggestWrapper\NovaSuggestWrapper, like so:
/* ... */ use \Illizian\NovaSuggestWrapper\NovaSuggestWrapper; /* ... */ class Example extends Resource { /* ... */ public function fields(Request $request) { return [ /* ... */ NovaSuggestWrapper::make( [ Textarea::make(__('Textarea'), 'textarea') ] )->suggestions([ "foo", "foobar" ]), ]; }
You can update the trigger character with the trigger(string $char) method, for example, here we allow people to mention User's by their username using the @ character:
/* ... */ use \App\Models\User; use \Illizian\NovaSuggestWrapper\NovaSuggestWrapper; /* ... */ class Example extends Resource { /* ... */ public function fields(Request $request) { $users = User::all()->pluck('username')->toArray(); return [ /* ... */ NovaSuggestWrapper::make( [ Textarea::make(__('Textarea'), 'textarea') ] )->trigger('@')->suggestions($users), ]; }
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 403
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-21
