<?php
namespace Moto\Application\Languages; use Moto\Json\Server; use Moto\Json\Request; use Moto\Json\Response; use Moto; class Service extends Moto\Service\AbstractStaticService { protected static $_resourceName = 'languages'; protected static $_resourcePrivilegesMap = array( 'getList' => 'get', ); public static function getList($request = null) { $query = Moto\Database\Models\Language::query(); $query->where([ 'del' => 0, ]); $items = $query->orderBy('priority')->orderBy('id')->get(['id', 'code', 'locale', 'name']); $response = new Moto\Json\Response\Collection(); $response->meta->exchangeArray(array( 'total' => $items->count(), 'page' => 1, )); $response->records = $items->toArray(); return $response; } } 