<?php
 namespace VnChocola\Module\Api;
 use TCMS\Module;
 use Route;
 use Model;
 use LayoutData;
 class Seats extends Module {
 protected function initialize() {
 }
 protected function registerRoutes() {
 Route::get('/seats', 'IndexController', 'getList')->name('index');
 Route::get('/seats/getByFloor', 'IndexController', 'getByFloor')->name('getByFloor');
 Route::get('/seats/getByBranch', 'IndexController', 'getByBranch')->name('getByBranch');
 Route::post('/seats/save', 'IndexController', 'save')->name('save');
 }
 public function registerComponent() {
 Model::add('SeatsModel', \VnChocola\Model\SeatsModel::class, true);
 Model::add('FloorsModel', \VnChocola\Model\FloorsModel::class, true);
 }
 public function boot() {
 }
 public function middleware(string $routeName, $auth) {
 switch($routeName) {
 case 'getByFloor': case 'getByBranch': case 'index': return $auth->hasRole(\RoleGlobal::$role->viewFloorManager) || $auth->hasRole(\RoleGlobal::$role->designFloorManager);
 case 'save': return $auth->hasRole(\RoleGlobal::$role->designFloorManager);
 default: return false;
 }
 }
 }
