Skip to content

Instantly share code, notes, and snippets.

@duongtdvn
duongtdvn / Address.php
Created April 1, 2022 04:12
Laravel enum casting for country
<?php
namespace App\Models;
use App\Enums\Country;
use Illuminate\Database\Eloquent\Model;
class Address extends Model
{
protected $casts = [
@duongtdvn
duongtdvn / countries.php
Created March 31, 2022 09:22
PHP 8.1 Enum Country Codes ISO 3166
// Inspired by https://gist.github.com/evolkmann/740d24889c509c08484a8ff72af5dd64
<?php
namespace App\Enums;
enum Country: string
{
case AF = 'Afghanistan';
case AX = 'AlandIslands';
case AL = 'Albania';
(window.webpackJsonp = window.webpackJsonp || []).push([[11], {
"+bJz": function(l, n, u) {
"use strict";
u.d(n, "a", (function() {
return t
}
));
class t {
constructor() {}
ngOnInit() {}