Displaying estimates
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user