MexOrderRepository.php 861 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Module\Mex\Repositories;
  3. use App\Module\Mex\Models\MexOrder;
  4. use UCore\DcatAdmin\Repository\EloquentRepository;
  5. /**
  6. * 农贸市场订单仓库
  7. *
  8. * 提供农贸市场订单数据的访问和操作功能。
  9. * 该类是订单模块与后台管理系统的桥梁,用于处理订单数据的CRUD操作。
  10. */
  11. class MexOrderRepository extends EloquentRepository
  12. {
  13. /**
  14. * 关联的模型类
  15. *
  16. * @var string
  17. */
  18. protected $eloquentClass = MexOrder::class;
  19. /**
  20. * 构造函数,支持预加载关联关系
  21. *
  22. * @param array $with 预加载的关联关系
  23. */
  24. public function __construct(array $with = [])
  25. {
  26. // 默认预加载商品信息
  27. $defaultWith = ['item'];
  28. $relations = array_merge($defaultWith, $with);
  29. parent::__construct($relations);
  30. }
  31. }