PHP code example of hetparekh21 / searchable

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

    

hetparekh21 / searchable example snippets


use hetparekh21\searchable\Searchable;

class User extends Model
{
    use Searchable;

    protected $fillable = [
        'first_name',
        'last_name',
        'email',
        'phone'
    ];

    protected $guarded = ['id'];

    protected $except = ['phone'];

    protected $useGuarded = false;

}

$users = User::search('John Doe')->get();

$users = User::search('John Doe')->paginate(10);