new deployer command

This commit is contained in:
Mark Gregory
2026-09-16 12:28:01 +01:00
parent 5d58e35275
commit 856038c762
13 changed files with 246 additions and 197 deletions
@@ -8,6 +8,11 @@ use Modules\Countries\Support\Iso3166;
class StoreCountryRequest extends FormRequest
{
private const ISO3 = 'size:3';
private const MAX_STRING = 'max:255';
private const MAX_SHORT = 'max:16';
/**
* Authorize country reference-data administration.
*/
@@ -38,29 +43,29 @@ class StoreCountryRequest extends FormRequest
{
return [
'alpha2' => ['required', 'string', 'size:2', 'uppercase', 'unique:countries,alpha2'],
'alpha3' => ['required', 'string', 'size:3', 'uppercase', 'unique:countries,alpha3'],
'numeric' => ['required', 'string', 'size:3', 'unique:countries,numeric'],
'name' => ['required', 'string', 'max:255'],
'official_name' => ['nullable', 'string', 'max:255'],
'common_name' => ['nullable', 'string', 'max:255'],
'display_name' => ['nullable', 'string', 'max:255'],
'native_name' => ['nullable', 'string', 'max:255'],
'capital' => ['nullable', 'string', 'max:255'],
'flag_emoji' => ['nullable', 'string', 'max:16'],
'calling_code' => ['nullable', 'string', 'max:16'],
'tld' => ['nullable', 'string', 'max:16'],
'currency_code' => ['nullable', 'string', 'size:3', 'uppercase'],
'currency_name' => ['nullable', 'string', 'max:255'],
'currency_symbol' => ['nullable', 'string', 'max:16'],
'alpha3' => ['required', 'string', self::ISO3, 'uppercase', 'unique:countries,alpha3'],
'numeric' => ['required', 'string', self::ISO3, 'unique:countries,numeric'],
'name' => ['required', 'string', self::MAX_STRING],
'official_name' => ['nullable', 'string', self::MAX_STRING],
'common_name' => ['nullable', 'string', self::MAX_STRING],
'display_name' => ['nullable', 'string', self::MAX_STRING],
'native_name' => ['nullable', 'string', self::MAX_STRING],
'capital' => ['nullable', 'string', self::MAX_STRING],
'flag_emoji' => ['nullable', 'string', self::MAX_SHORT],
'calling_code' => ['nullable', 'string', self::MAX_SHORT],
'tld' => ['nullable', 'string', self::MAX_SHORT],
'currency_code' => ['nullable', 'string', self::ISO3, 'uppercase'],
'currency_name' => ['nullable', 'string', self::MAX_STRING],
'currency_symbol' => ['nullable', 'string', self::MAX_SHORT],
'languages' => ['nullable', 'json'],
'timezones' => ['nullable', 'json'],
'latitude' => ['nullable', 'numeric', 'between:-90,90'],
'longitude' => ['nullable', 'numeric', 'between:-180,180'],
'flag_svg_url' => ['nullable', 'url', 'max:255'],
'flag_png_url' => ['nullable', 'url', 'max:255'],
'flag_svg_url' => ['nullable', 'url', self::MAX_STRING],
'flag_png_url' => ['nullable', 'url', self::MAX_STRING],
'ioc_code' => ['nullable', 'string', 'max:8'],
'fifa_code' => ['nullable', 'string', 'max:8'],
'postal_code_format' => ['nullable', 'string', 'max:255'],
'postal_code_format' => ['nullable', 'string', self::MAX_STRING],
'address_format' => ['nullable', 'string', 'max:5000'],
'is_active' => ['required', 'boolean'],
'iso_status' => ['required', 'string', Rule::in(Iso3166::statuses())],
@@ -70,10 +75,10 @@ class StoreCountryRequest extends FormRequest
'continent' => ['nullable', 'string', 'max:64'],
'region' => ['nullable', 'string', 'max:100'],
'subregion' => ['nullable', 'string', 'max:100'],
'intermediate_region' => ['nullable', 'string', 'max:255'],
'intermediate_region' => ['nullable', 'string', self::MAX_STRING],
'sort_order' => ['nullable', 'integer', 'min:0', 'max:999999'],
'source' => ['nullable', 'string', 'max:255'],
'source_version' => ['nullable', 'string', 'max:255'],
'source' => ['nullable', 'string', self::MAX_STRING],
'source_version' => ['nullable', 'string', self::MAX_STRING],
'last_synced_at' => ['nullable', 'date'],
'metadata' => ['nullable', 'json'],
];
@@ -8,6 +8,11 @@ use Modules\Countries\Support\Iso3166;
class UpdateCountryRequest extends FormRequest
{
private const ISO3 = 'size:3';
private const MAX_STRING = 'max:255';
private const MAX_SHORT = 'max:16';
/**
* Authorize country reference-data administration.
*/
@@ -40,29 +45,29 @@ class UpdateCountryRequest extends FormRequest
return [
'alpha2' => ['required', 'string', 'size:2', 'uppercase', Rule::unique('countries', 'alpha2')->ignore($countryId)],
'alpha3' => ['required', 'string', 'size:3', 'uppercase', Rule::unique('countries', 'alpha3')->ignore($countryId)],
'numeric' => ['required', 'string', 'size:3', Rule::unique('countries', 'numeric')->ignore($countryId)],
'name' => ['required', 'string', 'max:255'],
'official_name' => ['nullable', 'string', 'max:255'],
'common_name' => ['nullable', 'string', 'max:255'],
'display_name' => ['nullable', 'string', 'max:255'],
'native_name' => ['nullable', 'string', 'max:255'],
'capital' => ['nullable', 'string', 'max:255'],
'flag_emoji' => ['nullable', 'string', 'max:16'],
'calling_code' => ['nullable', 'string', 'max:16'],
'tld' => ['nullable', 'string', 'max:16'],
'currency_code' => ['nullable', 'string', 'size:3', 'uppercase'],
'currency_name' => ['nullable', 'string', 'max:255'],
'currency_symbol' => ['nullable', 'string', 'max:16'],
'alpha3' => ['required', 'string', self::ISO3, 'uppercase', Rule::unique('countries', 'alpha3')->ignore($countryId)],
'numeric' => ['required', 'string', self::ISO3, Rule::unique('countries', 'numeric')->ignore($countryId)],
'name' => ['required', 'string', self::MAX_STRING],
'official_name' => ['nullable', 'string', self::MAX_STRING],
'common_name' => ['nullable', 'string', self::MAX_STRING],
'display_name' => ['nullable', 'string', self::MAX_STRING],
'native_name' => ['nullable', 'string', self::MAX_STRING],
'capital' => ['nullable', 'string', self::MAX_STRING],
'flag_emoji' => ['nullable', 'string', self::MAX_SHORT],
'calling_code' => ['nullable', 'string', self::MAX_SHORT],
'tld' => ['nullable', 'string', self::MAX_SHORT],
'currency_code' => ['nullable', 'string', self::ISO3, 'uppercase'],
'currency_name' => ['nullable', 'string', self::MAX_STRING],
'currency_symbol' => ['nullable', 'string', self::MAX_SHORT],
'languages' => ['nullable', 'json'],
'timezones' => ['nullable', 'json'],
'latitude' => ['nullable', 'numeric', 'between:-90,90'],
'longitude' => ['nullable', 'numeric', 'between:-180,180'],
'flag_svg_url' => ['nullable', 'url', 'max:255'],
'flag_png_url' => ['nullable', 'url', 'max:255'],
'flag_svg_url' => ['nullable', 'url', self::MAX_STRING],
'flag_png_url' => ['nullable', 'url', self::MAX_STRING],
'ioc_code' => ['nullable', 'string', 'max:8'],
'fifa_code' => ['nullable', 'string', 'max:8'],
'postal_code_format' => ['nullable', 'string', 'max:255'],
'postal_code_format' => ['nullable', 'string', self::MAX_STRING],
'address_format' => ['nullable', 'string', 'max:5000'],
'is_active' => ['required', 'boolean'],
'iso_status' => ['required', 'string', Rule::in(Iso3166::statuses())],
@@ -72,10 +77,10 @@ class UpdateCountryRequest extends FormRequest
'continent' => ['nullable', 'string', 'max:64'],
'region' => ['nullable', 'string', 'max:100'],
'subregion' => ['nullable', 'string', 'max:100'],
'intermediate_region' => ['nullable', 'string', 'max:255'],
'intermediate_region' => ['nullable', 'string', self::MAX_STRING],
'sort_order' => ['nullable', 'integer', 'min:0', 'max:999999'],
'source' => ['nullable', 'string', 'max:255'],
'source_version' => ['nullable', 'string', 'max:255'],
'source' => ['nullable', 'string', self::MAX_STRING],
'source_version' => ['nullable', 'string', self::MAX_STRING],
'last_synced_at' => ['nullable', 'date'],
'metadata' => ['nullable', 'json'],
];
+6 -4
View File
@@ -5,6 +5,8 @@ use Modules\Countries\Http\Controllers\CountriesController;
use Modules\Countries\Http\Controllers\CountrySyncController;
use Modules\Countries\Http\Controllers\ReferenceDataController;
const COUNTRY_ROUTE = COUNTRY_ROUTE;
Route::prefix('countries')->name('countries.')->middleware(['web', 'auth'])->group(function (): void {
Route::get('/', CountriesController::class)->name('index');
Route::get('/create', [CountriesController::class, 'create'])->name('create');
@@ -15,8 +17,8 @@ Route::prefix('countries')->name('countries.')->middleware(['web', 'auth'])->gro
Route::get('/reference/languages', [ReferenceDataController::class, 'languages'])->name('languages.index');
Route::get('/reference/scripts', [ReferenceDataController::class, 'scripts'])->name('scripts.index');
Route::get('/reference/locodes', [ReferenceDataController::class, 'locodes'])->name('locodes.index');
Route::get('/{country:alpha2}', [CountriesController::class, 'show'])->name('show');
Route::get('/{country:alpha2}/edit', [CountriesController::class, 'edit'])->name('edit');
Route::put('/{country:alpha2}', [CountriesController::class, 'update'])->name('update');
Route::delete('/{country:alpha2}', [CountriesController::class, 'destroy'])->name('destroy');
Route::get(COUNTRY_ROUTE, [CountriesController::class, 'show'])->name('show');
Route::get(COUNTRY_ROUTE . '/edit', [CountriesController::class, 'edit'])->name('edit');
Route::put(COUNTRY_ROUTE, [CountriesController::class, 'update'])->name('update');
Route::delete(COUNTRY_ROUTE, [CountriesController::class, 'destroy'])->name('destroy');
});