PHP code example of suenerds / nova-searchable-belongs-to-filter

1. Go to this page and download the library: Download suenerds/nova-searchable-belongs-to-filter 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/ */

    

suenerds / nova-searchable-belongs-to-filter example snippets


BelongsTo::make('User')
    ->searchable()
    ->filterable(),

// app/Nova/User.php

use Suenerds\NovaSearchableBelongsToFilter\NovaSearchableBelongsToFilter

public function filters(Request $request)
{
    return [
	(new NovaSearchableBelongsToFilter('my-new-name'))
	    ->fieldAttribute('department')
	    ->filterBy('department_id')
    ];
}