original_string: public function index(Incident $incident)
      {
          $updates = $incident->updates()->orderBy('created_at', 'desc');
  
          if ($sortBy = Binput::get('sort')) {
              $direction = Binput::has('order') && Binput::get('order') == 'desc';
  
              $updates->sort($sortBy, $direction);
          }
  
          $updates = $updates->paginate(Binput::get('per_page', 20));
  
          return $this->paginator($updates, Request::instance());
      }
code: public function index(Incident $incident)
      {
          $updates = $incident->updates()->orderBy('created_at', 'desc');
  
          if ($sortBy = Binput::get('sort')) {
              $direction = Binput::has('order') && Binput::get('order') == 'desc';
  
              $updates->sort($sortBy, $direction);
          }
  
          $updates = $updates->paginate(Binput::get('per_page', 20));
  
          return $this->paginator($updates, Request::instance());
      }
code_tokens: public function index ( Incident $ incident ) { $ updates = $ incident -> updates ( ) -> orderBy ( 'created_at' , 'desc' ) ; if ( $ sortBy = Binput :: get ( 'sort' ) ) { $ direction = Binput :: has ( 'order' ) && Binput :: get ( 'order' ) == 'desc' ; $ updates -> sort ( $ sortBy , $ direction ) ; } $ updates = $ updates -> paginate ( Binput :: get ( 'per_page' , 20 ) ) ; return $ this -> paginator ( $ updates , Request :: instance ( ) ) ; }
docstring: Return all updates on the incident.
  
  @param \CachetHQ\Cachet\Models\Incident $incident
  
  @return \Illuminate\Http\JsonResponse
docstring_tokens: Return all updates on the incident .