'integer', 'name' => 'string', 'country_id' => 'string', 'country_name' => 'string', 'state_code' => 'string', 'latitude' => 'float', 'longitude' => 'float', ]; public static function getStateOptions(?string $code = null): Collection { if ($code === null) { return collect(); } return self::where('country_id', $code)->get()->pluck('name', 'id'); } public function country(): BelongsTo { return $this->belongsTo(Country::class, 'country_id', 'id'); } public function cities(): HasMany { return $this->hasMany(City::class, 'state_id', 'id'); } }