PHP code example of statview / filament-record-finder

1. Go to this page and download the library: Download statview/filament-record-finder 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/ */

    

statview / filament-record-finder example snippets


use App\Models\User;
use Filament\Tables\Columns;
use Filament\Tables\Table;
use Statview\FilamentRecordFinder\RecordFinder;

class RecordFinderDemo extends RecordFinder
{
    public function table(Table $table)
    {
        return $table
            ->query(
                fn () => User::query()
                    ->whereNotIn('id', $this->existingRecord)
            )
            ->columns([
                Columns\TextColumn::make('name')
                    ->searchable()
                    ->sortable(),
            ]);
    }
}

use Filament\Tables\Columns\TextColumn;
use Statview\FilamentRecordFinder\Forms\RecordFinder;

RecordFinder::make('pages')
    ->label('Subpages')
    ->relation('pages', 'title')
    ->grid()
    ->recordFinder(RecordFinderDemo::class),