<?php
 namespace VnChocola\Module\Master;
 use TCMS\Module;
 use Route;
 use Model;
 use LayoutData;
 class MasterDistricts extends Module {
 protected function initialize() {
 }
 protected function registerRoutes() {
 Route::get('/districts', 'IndexController', 'index')->name('index');
 Route::get('/districts/create', 'IndexController', 'create')->name('create');
 Route::post('/districts/create', 'IndexController', 'postCreate')->name('postCreate');
 Route::get('/districts/update/{id}', 'IndexController', 'update')->name('update');
 Route::post('/districts/update/{id}', 'IndexController', 'postUpdate')->name('update');
 Route::post('/districts/delete', 'IndexController', 'postDelete')->name('delete');
 }
 public function registerComponent() {
 Model::add('CitysModel',\VnChocola\Model\CitysModel::class,true);
 Model::add('DistrictsModel',\VnChocola\Model\DistrictsModel::class,true);
 }
 public function boot() {
 LayoutData::addSubMenuItem('districts', route('index'), lang('district_model.name'), 'city', 'primary', function(\LayoutMenuItem $menuItem) {
 $menuItem->middleware = function($auth) {
 return $auth->hasRole(\RoleGlobal::$role->superCityManager);
 }
;
 }
);
 }
 public function middleware(string $routeName, $auth) {
 return $auth->hasRole(\RoleGlobal::$role->superCityManager);
 }
 }
