original_string: public function index()
      {
          $incidentVisibility = app(Guard::class)->check() ? 0 : 1;
  
          $incidents = Incident::where('visible', '>=', $incidentVisibility);
  
          $incidents->search(Binput::except(['sort', 'order', 'per_page']));
  
          if ($sortBy = Binput::get('sort')) {
              $direction = Binput::has('order') && Binput::get('order') == 'desc';
  
              $incidents->sort($sortBy, $direction);
          }
  
          $incidents = $incidents->paginate(Binput::get('per_page', 20));
  
          return $this->paginator($incidents, Request::instance());
      }
code: public function index()
      {
          $incidentVisibility = app(Guard::class)->check() ? 0 : 1;
  
          $incidents = Incident::where('visible', '>=', $incidentVisibility);
  
          $incidents->search(Binput::except(['sort', 'order', 'per_page']));
  
          if ($sortBy = Binput::get('sort')) {
              $direction = Binput::has('order') && Binput::get('order') == 'desc';
  
              $incidents->sort($sortBy, $direction);
          }
  
          $incidents = $incidents->paginate(Binput::get('per_page', 20));
  
          return $this->paginator($incidents, Request::instance());
      }
code_tokens: public function index ( ) { $ incidentVisibility = app ( Guard :: class ) -> check ( ) ? 0 : 1 ; $ incidents = Incident :: where ( 'visible' , '>=' , $ incidentVisibility ) ; $ incidents -> search ( Binput :: except ( [ 'sort' , 'order' , 'per_page' ] ) ) ; if ( $ sortBy = Binput :: get ( 'sort' ) ) { $ direction = Binput :: has ( 'order' ) && Binput :: get ( 'order' ) == 'desc' ; $ incidents -> sort ( $ sortBy , $ direction ) ; } $ incidents = $ incidents -> paginate ( Binput :: get ( 'per_page' , 20 ) ) ; return $ this -> paginator ( $ incidents , Request :: instance ( ) ) ; }
docstring: Get all incidents.
  
  @return \Illuminate\Http\JsonResponse
docstring_tokens: Get all incidents .