public function query($q = null)
    {
        return User::where(function ($query) use ($q) {
            $query->where('email', 'like', "%{$q}")
                ->orWhere('name', 'like', "%{$q}");
        })->orderBy('email')->paginate();
    }
public function query($q = null)
    {
        return User::where(function ($query) use ($q) {
            $query->where('email', 'like', "%{$q}")
                ->orWhere('name', 'like', "%{$q}");
        })->orderBy('email')->paginate();
    }
public function query ( $ q = null ) { return User :: where ( function ( $ query ) use ( $ q ) { $ query -> where ( 'email' , 'like' , "%{$q}" ) -> orWhere ( 'name' , 'like' , "%{$q}" ) ; } ) -> orderBy ( 'email' ) -> paginate ( ) ; }
Queries the repository and returns a paginated result.

@param null|string $q
@return LengthAwarePaginator
Queries the repository and returns a paginated result .