laravel-search maintained by osamaalmamri
Description
This is my package laravel-search
Author
Last update
2023/10/09 07:39
(dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-5)
License
Downloads
4
Tags
package laravel-search
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.