Skip to content

Commit

Permalink
country accepts iso3
Browse files Browse the repository at this point in the history
  • Loading branch information
Mdhesari committed Feb 20, 2022
1 parent f571709 commit ba41d72
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/LaravelCountryStateCitiesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use Mdhesari\LaravelCountryStateCities\Models\Country;

class LaravelCountryStateCitiesServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -45,6 +46,10 @@ public function boot()
}

$this->handleRoutes();

Route::bind('country', function ($value) {
return Country::whereId($value)->orWhere('iso3', $value)->firstOrFail();
});
}

/**
Expand Down

0 comments on commit ba41d72

Please sign in to comment.