<?php

namespace App\Classes\Modules\Affiliate\Services;

use App\Classes\General\Eloquent\AbstractListRecord;
use App\Models\Affiliate;
use Illuminate\Database\Eloquent\Builder;

class ListsAffiliates extends AbstractListRecord
{
    /** @var Affiliate */
    private $repository;

    /**
     * ListsAffiliates constructor.
     * @param Affiliate $repository
     */
    public function __construct(Affiliate $repository)
    {
        $this->repository = $repository;
    }

    /**
     * @return Builder
     */
    function getRepository(): Builder
    {
        return $this->repository->newQuery()->with('creator')->orderBy('created_at', 'desc');
    }
}

