__('Standart'), self::EXPRESS => __('Express'), self::SELF_PICKUP => __('Self Pickup'), self::REGION => __('Region'), ]; } /** * Prices */ public static function prices(): array { return [ self::STANDART => self::STANDART_PRICE, self::EXPRESS => self::EXPRESS_PRICE, self::SELF_PICKUP => self::SELF_PICKUP_PRICE, self::REGION => self::REGION_PRICE, ]; } /** * Shipping times */ public static function times(): array { return [ self::MORNING => self::MORNING, self::EVENING => self::EVENING, ]; } /** * Get price for specific shipping */ public static function priceFor(string $type): int { return static::prices()[$type] ?? self::STANDART_PRICE; } /** * Order shipping price * * @param Order $order */ public static function orderShippingPrice($order): int { if ($order->region === Region::AG) { return static::priceFor($order->shipping_method); } if (in_array($order->province_id, [ 12, 43, 45, 83, 56, 22, ])) { return 30; } return static::REGION_PRICE; } /** * Formatted shipping method */ public static function formattedShippingMethod(string $shippingMethod): string { return static::values()[$shippingMethod] ?? __('Standart'); } /** * Get full address */ public static function fullAddress($region, $province, $customer_address): string { $address = ''; if ($region) { $address .= Region::labelFor($region); } if ($province = Province::where('id', $province)->first('name')) { $address .= ', '.$province->name; } if ($customer_address) { $address .= ','.$customer_address; } return $address; } }