From 45f2073e4624fd34c97cad1346eefb9862adf7f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=27Guessan=20Kouadio=20Elis=C3=A9e?= Date: Thu, 14 Oct 2021 17:12:13 +0000 Subject: [PATCH] update: readme --- README.md | 15 +++++++++++---- src/CountriesHelper.php | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 60bb1b6..8fee1c8 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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)@endforeach +@endif +@endforeach ``` ### Testing diff --git a/src/CountriesHelper.php b/src/CountriesHelper.php index 0ae451a..fa50acd 100644 --- a/src/CountriesHelper.php +++ b/src/CountriesHelper.php @@ -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)]; } })