Skip to content

oor30/laravel-where-like

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-where-like

Add whereLike query to laravel Illuminate\Database\Eloquent\Builder.

Illuminate\Database\Eloquent\BuilderクラスにwhereLikeメソッドを追加します。

install

composer require kazuki/laravel-where-like

Usage

// Search for Ichiro working in Tokyo
$words = ['Ichiro', 'Tokyo'];
$comulns = ['name', 'company.address'];
$users = User::whereLike($columns, $words)->get();

options

  • $position
    • -1: Forward Consistency (前方一致)
    • 1: Backward Consistency (後方一致)
    • 0: Partially Consistent (部分一致) (Default)
  • $boolean
    • 'and': Default
    • 'or'
// Search for who working in Tokyo or Osaka
$words = ['Tokyo', 'Osaka'];
$comulns = ['company.address'];
$users = User::whereLike($columns, $words, 0, 'or')->get();

About

Add where like query to laravel eloquent builder.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages