Displaying estimates
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Resources;
|
||||
|
||||
use App\Enumerations\EatingHabit;
|
||||
use App\Enumerations\EfzStatus;
|
||||
use App\Enumerations\ParticipationType;
|
||||
use App\Models\CostUnitEstimate;
|
||||
use App\Models\EventParticipant;
|
||||
use App\ValueObjects\Age;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class CostUnitEstimateResource extends JsonResource
|
||||
{
|
||||
function __construct(CostUnitEstimate $estimate)
|
||||
{
|
||||
parent::__construct($estimate);
|
||||
}
|
||||
|
||||
public function toArray($request) : array
|
||||
{
|
||||
$amountString = $this->resource->flat_amount?->toString();
|
||||
if ($amountString === null) {
|
||||
$amountString = $this->resource->amount_by_user?->toString() . ' / Person';
|
||||
} else {
|
||||
$amountString .= ' Gesamt';
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $this->resource->id,
|
||||
'title' => $this->resource->description,
|
||||
'totalAmountString' => $amountString,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user