Looking to hire Laravel developers? Try LaraJobs

laravel-search maintained by osamaalmamri

Description
This is my package laravel-search
Last update
2023/10/09 07:39 (dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-5)
License
Downloads
4

Comments
comments powered by Disqus

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.