17 lines
402 B
PHP
17 lines
402 B
PHP
<?php
|
|
|
|
namespace App\Repositories;
|
|
|
|
use App\Models\CostUnit;
|
|
|
|
class EstimatesRepository {
|
|
public function getEstimates(CostUnit $costUnit, string $estimateType) : array {
|
|
$return = [];
|
|
foreach ($costUnit->estimates()->where('type', $estimateType)->get() as $estimate) {
|
|
$return[] = $estimate->toResource()->toArray(request());
|
|
}
|
|
|
|
return $return;
|
|
}
|
|
}
|