1234567891011121314151617181920212223242526272829 |
- <?php
- namespace App\Filters\Traits;
- use Illuminate\Database\Eloquent\Builder;
- trait RelationUserFilter
- {
- protected function mobile($val)
- {
- $this->builder->whereHas('users', function (Builder $query) use ($val) {
- $query->where('mobile', 'like', "%{$val}%");
- });
- }
- protected function nickname($val)
- {
- $this->builder->whereHas('users', function (Builder $query) use ($val) {
- $query->where('nickname', 'like', "%{$val}%");
- });
- }
- protected function mobileNickname($val){
- $this->builder->whereHas('users', function (Builder $query) use ($val) {
- $query->where('mobile', 'like', "%{$val}%")
- ->Orwhere('nickname', 'like', "%{$val}%");
- });
- }
- }
|