Skip to content

Commit

Permalink
update: readme
Browse files Browse the repository at this point in the history
  • Loading branch information
eliseekn committed Oct 14, 2021
1 parent 76070a7 commit 45f2073
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Very short description of the package
# Countries helper

[![Latest Version on Packagist](https://img.shields.io/packagist/v/eliseekn/countries-helper.svg?style=flat-square)](https://packagist.org/packages/eliseekn/countries-helper)
[![Total Downloads](https://img.shields.io/packagist/dt/eliseekn/countries-helper.svg?style=flat-square)](https://packagist.org/packages/eliseekn/countries-helper)
![GitHub Actions](https://github.com/eliseekn/countries-helper/actions/workflows/main.yml/badge.svg)

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
Helper for countries laravel package

## Installation

Expand All @@ -17,7 +16,15 @@ composer require eliseekn/countries-helper
## Usage

```php
// Usage description here
//In your controller
$countries = CountriesHelper::getAll();

//In your blade file
@foreach($countries as $country)
@if (!is_null($country))
@foreach($country as $key => $value)<option value="{{ $key }}">{{ $value }}</option>@endforeach
@endif
@endforeach
```

### Testing
Expand Down
2 changes: 1 addition & 1 deletion src/CountriesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function getAll(): array
return $countries->all()->map(function ($country) use ($countries) {
$country_name = $countries->where('cca2', $country->cca2)->first()[self::getLang()];

if (isset($country_name)) {
if (!empty($country_name)) {
return [$country->cca2 => utf8_decode($country_name)];
}
})
Expand Down

0 comments on commit 45f2073

Please sign in to comment.