PHP code example of techouse / select-auto-complete
1. Go to this page and download the library: Download techouse/select-auto-complete library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
techouse / select-auto-complete example snippets
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
->
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.