Skip to content
Snippets Groups Projects
v0.php 5.1 KiB
Newer Older
Route::set('apiv0:auth', 'api/v0/auth/<action>')
    ->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' => 'Auth',
    ]);

Route::set('apiv0:teacher', 'api/v0/teacher(/(<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' => '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:departments', 'api/v0/departments')
//    ->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'    => 'indexes',
//        'directory' => 'Api/V0',
//        'controller' => 'Department',
//    ]);
Artem Konenko's avatar
Artem Konenko committed

//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',
//    ]);
//Route::set('apiv0:subject:another', 'api/v0/subject/<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' => 'Subject',
//    ]);

Route::set('apiv0:studyPlan', 'api/v0/studyPlan')
    ->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' => 'StudyPlan',