feat: install Sanctum, scaffold api.php, add FuelType::fromAlias()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ovidiu U
2026-04-04 19:10:05 +01:00
parent c815597a98
commit a30dbdfbba
6 changed files with 187 additions and 5 deletions

View File

@@ -4,15 +4,28 @@ namespace App\Enums;
enum FuelType: string
{
case E10 = 'e10';
case E5 = 'e5';
case E10 = 'e10';
case E5 = 'e5';
case B7Standard = 'b7_standard';
case B7Premium = 'b7_premium';
case B10 = 'b10';
case Hvo = 'hvo';
case B7Premium = 'b7_premium';
case B10 = 'b10';
case Hvo = 'hvo';
public static function fromApiValue(string $value): self
{
return self::from(strtolower($value));
}
public static function fromAlias(string $alias): self
{
return match (strtolower($alias)) {
'diesel', 'b7_standard' => self::B7Standard,
'premium_diesel', 'b7_premium' => self::B7Premium,
'petrol', 'unleaded', 'e10' => self::E10,
'premium_unleaded', 'e5' => self::E5,
'b10' => self::B10,
'hvo' => self::Hvo,
default => throw new \ValueError("Unknown fuel type alias: {$alias}"),
};
}
}