<?php

namespace App\Classes\Modules\Orders\Services;


use App\Models\Order;
use App\Http\Resources\Order as OrderResource;

class ListsOrder
{
    /** @var  Order */
    private $repository;

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


    public function execute(String $category){

        $category === 'complete' ? $order = $this->repository->where('complete',true)->paginate(10) :
                                   $order = $this->repository->where('complete',false)->paginate(10);
        return OrderResource::collection($order);
    }

}