<?php
 namespace VnChocola\Module\Api;
 use TCMS\Module;
 use Route;
 use Model;
 use LayoutData;
 class Floors extends Module {
 protected function initialize() {
 }
 protected function registerRoutes() {
 Route::get('/floors', 'IndexController', 'getList')->name('index');
 Route::get('/floors/{id}', 'IndexController', 'find')->name('find');
 Route::post('/floors/create', 'IndexController', 'create')->name('create');
 Route::post('/floors/update', 'IndexController', 'update')->name('update');
 Route::post('/floors/delete', 'IndexController', 'delete')->name('delete');
 }
 public function registerComponent() {
 Model::add('FloorsModel', \VnChocola\Model\FloorsModel::class, true);
 }
 public function boot() {
 }
 public function middleware(string $routeName, $auth) {
 switch($routeName) {
 case 'index': case 'find': return $auth->hasRole(\RoleGlobal::$role->viewFloor);
 case 'create': return $auth->hasRole(\RoleGlobal::$role->createFloor);
 case 'update': return $auth->hasRole(\RoleGlobal::$role->updateFloor);
 case 'delete': return $auth->hasRole(\RoleGlobal::$role->deleteFloor);
 default: return false;
 break;
 }
 }
 }
