使用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 />
"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"
},
模版引擎更换为Blade::class还是一样的错误
应该是传参错了 ,成了数据或是字符串
dto,老java了吧~