-
Notifications
You must be signed in to change notification settings - Fork 22
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
Comments
Can you provide some code? Also, what's your source for the performance degradation using the Facade? Thanks. |
you can see facade take 16 ms more than variable with 50 group 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']);
});
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: