cedricziel/l5-webartisan

网络工匠。在网页上执行 Artisan 命令。

0.0.2 2016-01-04 16:06 UTC

This package is auto-updated.

Last update: 2024-08-28 11:15:00 UTC


README

为您的应用程序提供基于浏览器的 artisan 控制台。

警告!

此插件默认不安全!您需要通过您选择的中间件来保护端点,否则陌生人将执行您的应用程序上的命令。

配置

将 ServiceProvider 添加到 config/app.php

    CedricZiel\Webartisan\WebartisanServiceProvider:class,

现在您需要覆盖插件提供的路由,以使用您选择的中间件来保护它们。

以下是一个示例,演示如何使用 auth 中间件来保护端点(在 app/Providers/RouteServiceProvider 中)

    /**
     * Define the routes for the application.
     *
     * @param  \Illuminate\Routing\Router $router
     *
     * @return void
     */
    public function map(Router $router)
    {
        $router->group(['namespace' => $this->namespace], function ($router) {
            require app_path('Http/routes.php');
        });

        /**
         * Webartisan routes
         */
        $router->group([
            'namespace'  => '\CedricZiel\Webartisan\Http\Controllers',
            'middleware' => ['web', 'auth']
        ], function ($router) {
            Route::get('artisan', [
                'as'         => 'artisan',
                'middleware' => 'auth',
                'uses'       => 'WebartisanController@show'
            ]);

            Route::post('artisan', [
                'as'         => 'artisan',
                'middleware' => 'auth',
                'uses'       => 'WebartisanController@execute'
            ]);
        });
    }

许可 & 致谢

此库基于 Ron Shpasser 的作品(https://github.com/shpasser/GaeSupportL5)。

此库采用 MIT 许可证。