<?php Route::set('apiv0:teacher', 'api/v0/teacher') ->filter(function($route, $params, $request) { // Prefix the method to the action name $params['action'] = strtolower($request->method()).'_'.$params['action']; return $params; // Returning an array will replace the parameters }) ->defaults([ 'action' => 'index', 'directory' => 'Api/V0', 'controller' => 'Teacher', ]); Route::set('apiv0:department', 'api/v0/department') ->filter(function($route, $params, $request) { // Prefix the method to the action name $params['action'] = strtolower($request->method()).'_'.$params['action']; return $params; // Returning an array will replace the parameters }) ->defaults([ 'action' => 'index', 'directory' => 'Api/V0', 'controller' => 'Department', ]); Route::set('apiv0:department:another', 'api/v0/department(/<action>(/<id>))', ['id' => '\d+']) ->filter(function($route, $params, $request) { // Prefix the method to the action name $params['action'] = strtolower($request->method()).'_'.$params['action']; return $params; // Returning an array will replace the parameters }) ->defaults([ 'action' => 'index', 'directory' => 'Api/V0', 'controller' => 'Department', ]); Route::set('apiv0:student', 'api/v0/student') ->filter(function($route, $params, $request) { // Prefix the method to the action name $params['action'] = strtolower($request->method()).'_'.$params['action']; return $params; // Returning an array will replace the parameters }) ->defaults([ 'action' => 'index', 'directory' => 'Api/V0', 'controller' => 'Student', ]); Route::set('apiv0:student:get', 'api/v0/student(/<id>)', ['id' => '\d+']) ->filter(function($route, $params, $request) { // Prefix the method to the action name $params['action'] = strtolower($request->method()).'_'.$params['action']; return $params; // Returning an array will replace the parameters }) ->defaults([ 'action' => 'index', 'directory' => 'Api/V0', 'controller' => 'Student', ]); Route::set('apiv0:student:another', 'api/v0/student(/<action>(/<id>))', ['id' => '\d+']) ->filter(function($route, $params, $request) { // Prefix the method to the action name $params['action'] = strtolower($request->method()).'_'.$params['action']; return $params; // Returning an array will replace the parameters }) ->defaults([ 'action' => 'index', 'directory' => 'Api/V0', 'controller' => 'Student', ]); Route::set('apiv0:subject', 'api/v0/subject') ->filter(function($route, $params, $request) { // Prefix the method to the action name $params['action'] = strtolower($request->method()).'_'.$params['action']; return $params; // Returning an array will replace the parameters }) ->defaults([ 'action' => 'index', 'directory' => 'Api/V0', 'controller' => 'Subject', ]);