mikaelpopowicz/nova-vue-select

A Laravel Nova field.


README

GitHub stars GitHub forks GitHub issues GitHub last commit

Laravel Nova Vue select

Introduction

Provides a capability of auto-completed searching resource.

Based on Vue-multiselect

Installation

You can install this Laravel Nova field via composer:

composer require mikaelpopowicz/nova-vue-select

Usage

// in your Nova Resource

VueSelect('Field label', 'attribute', OtherResource::class),

Filter

Create a Nova filter and make it inherit from VueSelectFilter. You may override constructor to set the Resource you want to fetch.

<?php

namespace App\Nova\Filters;

use App\Nova\User;
use Illuminate\Http\Request;
use Mikaelpopowicz\NovaVueSelect\VueSelectFilter;

class UserFilter extends VueSelectFilter
{
    public function __construct()
    {
        parent::__construct(User::class);
    }
    
    public function apply(Request $request, $query, $value)
    {
        return $query->where('user_id', '=', $value);
    }
}