Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no need to use route facade in route.php #3

Closed
d3v2a opened this issue May 29, 2016 · 2 comments
Closed

no need to use route facade in route.php #3

d3v2a opened this issue May 29, 2016 · 2 comments

Comments

@d3v2a
Copy link

d3v2a commented May 29, 2016

Maybe the first can be used but in group you can use route variable passed to the function

Facade is good for accessing one time or two but with more it increase boot time

Great job

@amochohan
Copy link
Owner

amochohan commented Jun 6, 2016

Can you provide some code? Also, what's your source for the performance degradation using the Facade? Thanks.

@d3v2a
Copy link
Author

d3v2a commented Jun 6, 2016

you can see facade take 16 ms more than variable with 50 group


code used:

for ($i = 0; $i < 50; $i++) {
    $router->group(['prefix' => $i], function ($router) use ($i) {
        $router->get('/', ['as' => $i . '.index', 'uses' => $i . '@index']);
        $router->get('/{id}', ['as' => $i . '.show', 'uses' => $i . '@show']);
        $router->get('/{id}/edit', ['as' => $i . '.edit', 'uses' => $i . '@edit']);
        $router->post('/update', ['as' => $i . '.update', 'uses' => $i . '@update']);
        $router->get('/create', ['as' => $i . '.create', 'uses' => $i . '@create']);
        $router->get('/store', ['as' => $i . '.store', 'uses' => $i . '@store']);
    });
}

code used:

for ($i = 0; $i < 50; $i++) {
    Route::group(['prefix' => $i], function () use ($i) {
        Route::get('/', ['as' => $i . '.index', 'uses' => $i . '@index']);
        Route::get('/{id}', ['as' => $i . '.show', 'uses' => $i . '@show']);
        Route::get('/{id}/edit', ['as' => $i . '.edit', 'uses' => $i . '@edit']);
        Route::post('/update', ['as' => $i . '.update', 'uses' => $i . '@update']);
        Route::get('/create', ['as' => $i . '.create', 'uses' => $i . '@create']);
        Route::get('/store', ['as' => $i . '.store', 'uses' => $i . '@store']);
    });
}

@d3v2a d3v2a closed this as completed Oct 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants