PHP code example of juniora / laravel-nova-search

1. Go to this page and download the library: Download juniora/laravel-nova-search 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/ */

    

juniora / laravel-nova-search example snippets


use AkkiIo\LaravelNovaSearch\LaravelNovaSearchable;

abstract class Resource extends NovaResource
{
    use LaravelNovaSearchable;
    
    // ...
}

/**
 * The columns that should be searched for any matching entry.
 *
 * @var array
 */
 public static $searchMatchingAny = [
    'first_name',
    'last_name',
    'email',
 ];

/**
 * The relationship columns that should be searched.
 *
 * @var array
 */
 public static $searchRelations = [
     'posts' => ['title', 'sub_title'],
 ];

/**
 * The relationship columns that should be searched.
 *
 * @var array
 */
public static $searchRelations = [
    'user.location' => ['state_abbr', 'country_abbr'],
];

/**
 * The relationship columns that should be searched for any matching entry.
 *
 * @var array
 */
 public static $searchRelationsMatchingAny = [
    'user' => ['first_name', 'last_name'],
 ];
 php

/**
 * The relationship columns that should to be concatenated and searched.
 *
 * @var array
 */
 public static $searchRelationsConcatenation = [
    'user' => [
        ['first_name', 'last_name'],
        ['email']
    ],
 ];