original_string: public function index()
      {
          if (app(Guard::class)->check()) {
              $components = Component::query();
          } else {
              $components = Component::enabled();
          }
  
          if ($tags = Binput::get('tags')) {
              $components->withAnyTags($tags);
          }
  
          $components->search(Binput::except(['sort', 'order', 'per_page']));
  
          if ($sortBy = Binput::get('sort')) {
              $direction = Binput::has('order') && Binput::get('order') == 'desc';
  
              $components->sort($sortBy, $direction);
          }
  
          $components = $components->paginate(Binput::get('per_page', 20));
  
          return $this->paginator($components, Request::instance());
      }
code: public function index()
      {
          if (app(Guard::class)->check()) {
              $components = Component::query();
          } else {
              $components = Component::enabled();
          }
  
          if ($tags = Binput::get('tags')) {
              $components->withAnyTags($tags);
          }
  
          $components->search(Binput::except(['sort', 'order', 'per_page']));
  
          if ($sortBy = Binput::get('sort')) {
              $direction = Binput::has('order') && Binput::get('order') == 'desc';
  
              $components->sort($sortBy, $direction);
          }
  
          $components = $components->paginate(Binput::get('per_page', 20));
  
          return $this->paginator($components, Request::instance());
      }
code_tokens: public function index ( ) { if ( app ( Guard :: class ) -> check ( ) ) { $ components = Component :: query ( ) ; } else { $ components = Component :: enabled ( ) ; } if ( $ tags = Binput :: get ( 'tags' ) ) { $ components -> withAnyTags ( $ tags ) ; } $ components -> search ( Binput :: except ( [ 'sort' , 'order' , 'per_page' ] ) ) ; if ( $ sortBy = Binput :: get ( 'sort' ) ) { $ direction = Binput :: has ( 'order' ) && Binput :: get ( 'order' ) == 'desc' ; $ components -> sort ( $ sortBy , $ direction ) ; } $ components = $ components -> paginate ( Binput :: get ( 'per_page' , 20 ) ) ; return $ this -> paginator ( $ components , Request :: instance ( ) ) ; }
docstring: Get all components.
  
  @return \Illuminate\Http\JsonResponse
docstring_tokens: Get all components .