added countries support expanded for ISO 3166 standard merged in new support
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Countries\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register Countries module routes.
|
||||
*/
|
||||
public function map(): void
|
||||
{
|
||||
$this->mapWebRoutes();
|
||||
$this->mapApiRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register web routes from the real module path.
|
||||
*/
|
||||
protected function mapWebRoutes(): void
|
||||
{
|
||||
$path = dirname(__DIR__).'/Routes/web.php';
|
||||
|
||||
if (is_file($path)) {
|
||||
Route::middleware(['web', 'auth'])->group($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register API routes from the real module path.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
$path = dirname(__DIR__).'/Routes/api.php';
|
||||
|
||||
if (is_file($path)) {
|
||||
Route::middleware(['api'])->prefix('api/v1')->group($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Countries\Http\Controllers\Api\CountryLookupController;
|
||||
|
||||
if (class_exists(CountryLookupController::class)) {
|
||||
Route::get('/countries', [CountryLookupController::class, 'index'])->name('api.countries.index');
|
||||
Route::get('/countries/{country:alpha2}', [CountryLookupController::class, 'show'])->name('api.countries.show');
|
||||
}
|
||||
Reference in New Issue
Block a user