PHP code example of osamaalmamri / laravel-search

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

    

osamaalmamri / laravel-search example snippets


return [

// this is the key namein Request $request 
 'key' => "search"
];

use OsamaAlmamri\LaravelSearch\Searchable;

class YourModal extends Model
{
  use Searchable;
  
  // define the name of cols 
  //if you need search in another fields of another table using the relation name then col name
  // you can search any  related relation as the following
      public $searchable = ['name','description','user.name','user.phone','user.role.name'];
}