Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
Bugfix: Replace helpers with class implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
pactode committed Sep 10, 2019
1 parent fab5faa commit a662d23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/macros/whereLike.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Builder;

Builder::macro('whereLike', function ($columns, string $value) {
$this->where(function (Builder $query) use ($columns, $value) {
foreach (array_wrap($columns) as $column) {
foreach (Arr::wrap($columns) as $column) {
$query->when(
str_contains($column, '.'),
Str::contains($column, '.'),

// Relational searches
function (Builder $query) use ($column, $value) {
Expand Down

0 comments on commit a662d23

Please sign in to comment.