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.

v1.1.1 2024-10-14 03:42 UTC

This package is auto-updated.

Last update: 2024-10-14 06:42:25 UTC


README

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

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.