backendRoutes.php 1.86 KB
Newer Older
1 2 3 4 5 6
<?php

use Illuminate\Routing\Router;

/** @var Router $router */
$router->bind('module', function ($module) {
7
    return app(\Nwidart\Modules\Contracts\RepositoryInterface::class)->find($module);
8 9 10 11 12
});
$router->bind('theme', function ($theme) {
    return app(\Modules\Workshop\Manager\ThemeManager::class)->find($theme);
});

Nicolas Widart's avatar
Nicolas Widart committed
13 14
$router->group(
    ['prefix' => '/workshop'],
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
    function (Router $router) {
        $router->get('modules', [
            'as' => 'admin.workshop.modules.index',
            'uses' => 'ModulesController@index',
            'middleware' => 'can:workshop.modules.index',
        ]);
        $router->get('modules/{module}', [
            'as' => 'admin.workshop.modules.show',
            'uses' => 'ModulesController@show',
            'middleware' => 'can:workshop.modules.show',
        ]);
        $router->post('modules/update', [
            'as' => 'admin.workshop.modules.update',
            'uses' => 'ModulesController@update',
            'middleware' => 'can:workshop.modules.update',
        ]);
        $router->post('modules/disable/{module}', [
            'as' => 'admin.workshop.modules.disable',
            'uses' => 'ModulesController@disable',
            'middleware' => 'can:workshop.modules.disable',
        ]);
        $router->post('modules/enable/{module}', [
            'as' => 'admin.workshop.modules.enable',
            'uses' => 'ModulesController@enable',
            'middleware' => 'can:workshop.modules.enable',
        ]);

        $router->get('themes', [
            'as' => 'admin.workshop.themes.index',
            'uses' => 'ThemesController@index',
            'middleware' => 'can:workshop.themes.index',
        ]);
        $router->get('themes/{theme}', [
            'as' => 'admin.workshop.themes.show',
            'uses' => 'ThemesController@show',
            'middleware' => 'can:workshop.themes.show',
        ]);
    }
);