使用Eloquent ORM 分页报错

oops

问题描述

使用Eloquent ORM 分页报错

程序代码

<?php

namespace app\model;
use support\Model;

class Order extends Model
{
    /**
     * The table associated with the model.
     */
    protected $table = 'order';

    protected $guarded = [];
}

<?php

namespace app\repository;

use app\dto\order\OrderListDto;
use app\model\Order;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;

class OrderRepository
{
    public function list(OrderListDto $dto): LengthAwarePaginator
    {
        return Order::where('uid',$dto->getUid())->paginate($dto->getLimit());
    }
}

报错信息

TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, no array or string given in
E:\code\he\vendor\illuminate\pagination\AbstractPaginator.php:558<br />

操作系统及workerman/webman等框架组件具体版本

windows环境

php8.1

  "require": {
    "php": "^8.1",
    "workerman/webman-framework": "^1.5.0",
    "monolog/monolog": "^2.0",
    "psr/container": "1.1.1",
    "doctrine/annotations": "1.14",
    "robmorgan/phinx": "^0.14.0",
    "webman/redis-queue": "^1.3",
    "tinywan/validate": "^0.0.6",
    "php-di/php-di": "^7.0.0",
    "illuminate/database": "10.48.12",
    "illuminate/pagination": "10.48.12",
    "symfony/var-dumper": "*",
    "illuminate/redis": "^10.48",
    "illuminate/events": "^10.48"
  },
474 2 0
2个回答

10bang
  • oops 2024-07-31

    模版引擎更换为Blade::class还是一样的错误

  • jesse 2024-08-06

    应该是传参错了 ,成了数据或是字符串

muyu

dto,老java了吧~

  • 暂无评论
×
🔝