original_string: public function index()
      {
          $groups = ComponentGroup::query();
          if (!$this->guard->check()) {
              $groups = ComponentGroup::visible();
          }
  
          $groups->search(Binput::except(['sort', 'order', 'per_page']));
  
          if ($sortBy = Binput::get('sort')) {
              $direction = Binput::get('order', 'asc');
  
              $groups->sort($sortBy, $direction);
          }
  
          $groups = $groups->paginate(Binput::get('per_page', 20));
  
          return $this->paginator($groups, Request::instance());
      }
code: public function index()
      {
          $groups = ComponentGroup::query();
          if (!$this->guard->check()) {
              $groups = ComponentGroup::visible();
          }
  
          $groups->search(Binput::except(['sort', 'order', 'per_page']));
  
          if ($sortBy = Binput::get('sort')) {
              $direction = Binput::get('order', 'asc');
  
              $groups->sort($sortBy, $direction);
          }
  
          $groups = $groups->paginate(Binput::get('per_page', 20));
  
          return $this->paginator($groups, Request::instance());
      }
code_tokens: public function index ( ) { $ groups = ComponentGroup :: query ( ) ; if ( ! $ this -> guard -> check ( ) ) { $ groups = ComponentGroup :: visible ( ) ; } $ groups -> search ( Binput :: except ( [ 'sort' , 'order' , 'per_page' ] ) ) ; if ( $ sortBy = Binput :: get ( 'sort' ) ) { $ direction = Binput :: get ( 'order' , 'asc' ) ; $ groups -> sort ( $ sortBy , $ direction ) ; } $ groups = $ groups -> paginate ( Binput :: get ( 'per_page' , 20 ) ) ; return $ this -> paginator ( $ groups , Request :: instance ( ) ) ; }
docstring: Get all groups.
  
  @return \Illuminate\Http\JsonResponse
docstring_tokens: Get all groups .