feat: add price classification enum and reliable sort option
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Resources\Api;
|
||||
|
||||
use App\Enums\PriceClassification;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Carbon;
|
||||
@@ -26,6 +27,12 @@ class StationResource extends JsonResource
|
||||
'price_updated_at' => $this->price_effective_at
|
||||
? Carbon::parse($this->price_effective_at)->toISOString()
|
||||
: null,
|
||||
'price_classification' => PriceClassification::fromUpdatedAt(
|
||||
$this->price_effective_at ? Carbon::parse($this->price_effective_at) : null
|
||||
)->value,
|
||||
'price_classification_label' => PriceClassification::fromUpdatedAt(
|
||||
$this->price_effective_at ? Carbon::parse($this->price_effective_at) : null
|
||||
)->label(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user