diarsa / laravel-where-like
A Laravel package that simplifies searching across multiple fields, including related models, using Laravel's query builder in an efficient way.
Fund package maintenance!
diarsa
Requires
- php: ^8.2
- illuminate/contracts: ^10.0||^11.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
README
Search using Laravel's query builder across multiple fields, including related models, in a simple and efficient way.
Installation
You can install the package via composer:
composer require diarsa/laravel-where-like
Usage
In query builder, you can perform searches across multiple fields, including related models, using this method.
$search = $request->search; return User::where('status', 1) ->whereLike(['name', 'address', 'categoryDetail.category_code', 'histories.device'], $search) ->get();
Another methods.
$laravelWhereLike = new Diarsa\LaravelWhereLike\LaravelWhereLike(); echo $laravelWhereLike->tambah(1, 4); use Diarsa\LaravelWhereLike\LaravelWhereLike; Route::get('calculate', function() { return LaravelWhereLike::tambah(1, 4); });
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Support us
You can support us by Buy me a coffee.
Credits
License
The MIT License (MIT). Please see License File for more information.