HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/vebon.komma.pro/app/KommaApp/Countries/Kms/CountryRepository.php
<?php

namespace KommaApp\Countries\Kms;

/**
 *
 *
 * @author      Tim Van Samang <timvansamang@komma.pro>
 * @copyright   (c) 2012-2016, Komma Mediadesign
 */


use Illuminate\Support\Collection;
use KommaApp\Kms\Core\KmsSiteRepository;
use KommaApp\Kms\Core\Kms;
use KommaApp\Countries\Models\Country;

class CountryRepository extends KmsSiteRepository
{
    function __construct(Kms $kms)
    {
        parent::__construct($kms);
    }


    /**
     * This method will get the Countries for a select.
     *
     * @param null $siteId
     * @return array
     */
    public function getCountriesForSiteSelectBox()
    {
        $models = [];
        foreach (Country::all() as $record) {
            $model = [];
            $model['value'] = $record->id;
            $model['content'] = $record->name;
            if (\Lang::has('countries.' . $record->iso_2)) {
                $model['content'] = \Lang::get('countries.' . $record->iso_2);
            }


            $models[] = $model;
        }
        return $models;
    }

    public function getCountriesForSelect()
    {
        $records = Country::all();
        $entities = [];
        foreach ($records as $record) {
            $entity = [];
            $entity['value'] = $record->id;
            $entity['content'] = $record->name;
            if (\Lang::has('countries.' . $record->iso_2)) {
                $model['content'] = \Lang::get('countries.' . $record->iso_2);
            }
            $entities[] = $entity;
        }
        return $entities;
    }
}