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