24 lines
779 B
PHP
24 lines
779 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Modules\Procurement\Services;
|
||
|
|
|
||
|
|
use App\Modules\Procurement\Contracts\ProcurementServiceInterface;
|
||
|
|
use App\Modules\Procurement\Models\PurchaseOrder;
|
||
|
|
use Illuminate\Support\Collection;
|
||
|
|
|
||
|
|
class ProcurementService implements ProcurementServiceInterface
|
||
|
|
{
|
||
|
|
public function getPurchaseOrdersByDate(string $start, string $end, array $statuses = ['received', 'completed']): Collection
|
||
|
|
{
|
||
|
|
return PurchaseOrder::with(['vendor'])
|
||
|
|
->whereIn('status', $statuses)
|
||
|
|
->whereBetween('created_at', [$start . ' 00:00:00', $end . ' 23:59:59'])
|
||
|
|
->get();
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getPurchaseOrdersByIds(array $ids, array $with = []): Collection
|
||
|
|
{
|
||
|
|
return PurchaseOrder::whereIn('id', $ids)->with($with)->get();
|
||
|
|
}
|
||
|
|
}
|