code: public function paginate()
      {
          $model = $this->model;
  
          if (property_exists($model, 'order')) {
              $paginator = $model::orderBy($model::$order, $model::$sort)->paginate($model::$paginate, $model::$index);
          } else {
              $paginator = $model::paginate($model::$paginate, $model::$index);
          }
  
          if (!$this->isPageInRange($paginator) && !$this->isFirstPage($paginator)) {
              throw new NotFoundHttpException();
          }
  
          if ($paginator->getTotal()) {
              $this->paginateLinks = $paginator->links();
          }
  
          return $paginator;
      }
docs: Get a paginated list of the models.
  
  @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
  
  @return \Illuminate\Database\Eloquent\Collection