osamaalmamri / laravel-search
This is my package laravel-search
1.0
2023-09-07 08:55 UTC
Requires
- php: ^8.0
- illuminate/database: ^8.0|^9.0
- illuminate/support: ^8.0|^9.0
- spatie/laravel-package-tools: ^1.9
Requires (Dev)
- mockery/mockery: ^1.4
- orchestra/testbench: ^6.23|^7.0
This package is auto-updated.
Last update: 2024-09-07 11:15:08 UTC
README
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.