Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. // Add this to the "boot()" method of your "AppServiceProvider"
  2.  
  3. <?php
  4.  
  5. \Illuminate\Database\Eloquent\Builder::macro('search', function ($name, $search) {
  6. return $this->where($name, 'LIKE', $search ? '%'.$search.'%' : '');
  7. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement