21 lines
525 B
PHP
21 lines
525 B
PHP
<?php
|
|
|
|
namespace Modules\Countries\Support;
|
|
|
|
use Illuminate\Support\Collection;
|
|
use Modules\Countries\Models\Country;
|
|
|
|
class CountryRepository
|
|
{
|
|
public function activeForSelect(): Collection
|
|
{
|
|
return Country::query()->active()->ordered()
|
|
->get(['id', 'alpha2', 'alpha3', 'numeric', 'name', 'display_name', 'common_name', 'flag_emoji']);
|
|
}
|
|
|
|
public function findByAlpha2(string $alpha2): ?Country
|
|
{
|
|
return Country::query()->where('alpha2', strtoupper($alpha2))->first();
|
|
}
|
|
}
|