Skip to content

mbs047/Simple-Eloquent-Search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple Eloquent Search

A laravel package to search via your models .

installation : composer require devhereco/simple-eloquent-search

Usage :

  • use Searchable trait in your model
  • Define $searchable property in your model to select which columns to search in

Example :

use devhereco\SimpleEloquentSearch\Searchable;

class User extends Model {

  use Searchable ;
  protected $searchable = ['name', 'posts.title'];
  
  public function posts(){
    return $this->hasMany(Post::class);
  }
}

// Calling search method
Model::search('ABC')->get();