Skip to content

OsamaAlmamri/laravel-search

Repository files navigation

package laravel-search

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

this package is facility the search in model with complex relations

Installation

You can install the package via composer:

composer require osamaalmamri/laravel-search

You can publish the config file with:

php artisan vendor:publish --tag="laravel-search-config"

This is the contents of the published config file:

return [

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

Usage

in the modal we use searchable class

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'];
}

Credits

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages