| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace App\Module\UrsPromotion\Repositories;
- use App\Module\UrsPromotion\Models\UrsPartnerDividendRecord;
- use Illuminate\Database\Eloquent\Model;
- /**
- * URS合伙人分红仓库类
- *
- * 仅供后台管理数据访问使用
- */
- class UrsPartnerDividendRepository
- {
- /**
- * 模型实例
- */
- protected Model $model;
- /**
- * 预加载关系
- */
- protected array $with;
- /**
- * 构造函数
- */
- public function __construct(array $with = [])
- {
- $this->model = new UrsPartnerDividendRecord();
- $this->with = array_merge(['transferApp'], $with);
- }
- /**
- * 获取查询构建器
- */
- public function query()
- {
- return $this->model->with($this->with);
- }
- /**
- * 根据ID查找记录
- */
- public function find(int $id): ?UrsPartnerDividendRecord
- {
- return $this->query()->find($id);
- }
- /**
- * 获取所有记录
- */
- public function all()
- {
- return $this->query()->get();
- }
- /**
- * 分页获取记录
- */
- public function paginate(int $perPage = 15)
- {
- return $this->query()->paginate($perPage);
- }
- }
|