<?php
 namespace Module\Event\Util; use Illuminate\Support\Facades\Cache; use ModStart\Core\Dao\ModelUtil; class EventUtil { public static function clearCache() { Cache::forget('EventCategories'); } public static function listCategories() { return Cache::rememberForever('EventCategories', function () { return ModelUtil::all('event_category', [], ['*'], ['sort', 'asc']); }); } public static function listEventByCategory($categoryId, $limit = 4) { return ModelUtil::model('event') ->where('categoryId', $categoryId) ->orderBy('id', 'desc') ->limit($limit)->get()->toArray(); } } 