feat: install Sanctum, scaffold api.php, add FuelType::fromAlias()
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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}"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user