original_string: public function scopeFilter($query, $request)
      {
          $request = Arr::only($request, ['name', 'description']);
  
          $query->actives()->where(function ($query) use ($request) {
              foreach ($request as $key => $value) {
                  $query->orWhere($key, 'like', '%' . $value . '%');
              }
              return $query;
          });
  
          return $query;
      }
code: public function scopeFilter($query, $request)
      {
          $request = Arr::only($request, ['name', 'description']);
  
          $query->actives()->where(function ($query) use ($request) {
              foreach ($request as $key => $value) {
                  $query->orWhere($key, 'like', '%' . $value . '%');
              }
              return $query;
          });
  
          return $query;
      }
code_tokens: public function scopeFilter ( $ query , $ request ) { $ request = Arr :: only ( $ request , [ 'name' , 'description' ] ) ; $ query -> actives ( ) -> where ( function ( $ query ) use ( $ request ) { foreach ( $ request as $ key => $ value ) { $ query -> orWhere ( $ key , 'like' , '%' . $ value . '%' ) ; } return $ query ; } ) ; return $ query ; }
docstring: Filter categories by the given request.
  
  @param  Illuminate\Database\Eloquent\Builder $query
  @param  array $request
  
  @return Illuminate\Database\Eloquent\Builder
docstring_tokens: Filter categories by the given request .