PHP code example of mayankjaviya / lara-finder

1. Go to this page and download the library: Download mayankjaviya/lara-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/ */

    

mayankjaviya / lara-finder example snippets


use mayankjaviya\LaraFinder\LaraFinder;

// Search for a value in specific columns
$results = LaraFinder::search('App\Models\User', 'John', ['name', 'email']);

// Search for a value across all columns
$results = LaraFinder::searchAll('App\Models\User', 'John');

// Search for a value across all columns except specified ones
$results = LaraFinder::searchAllExcept('App\Models\User', 'John', ['password']);

// It returns an associative array where each key represents a column name and the corresponding value is a collection of search results.
$results = LaraFinder::searchableColumns('App\Models\User', 'John', ['name', 'email']);

// Search for a value across multiple models
$models = ['App\Models\User', 'App\Models\Post'];
$results = LaraFinder::searchInMultipleModel($models, 'John');

// Search for a value within a related model
$results = LaraFinder::searchWithRelation('App\Models\User', 'John', 'App\Models\Post');