Displaying estimates
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Budget\Controllers;
|
||||
|
||||
use App\Enumerations\InvoiceType;
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListController extends CommonController
|
||||
{
|
||||
public function __invoke(int $costUnitId, string $estimateType, Request $request) : JsonResponse {
|
||||
$costUnit = $this->costUnits->getById($costUnitId);
|
||||
$estimates = $this->estimates->getEstimates($costUnit, $estimateType);
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'costUnitId' => $costUnitId,
|
||||
'title' => InvoiceType::where('slug', $estimateType)->first()->name,
|
||||
'estimates' => $estimates,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user