laravel-advanced-route
laravel-advanced-route copied to clipboard
Automatically naming routes
Could add a way to name the routes automatically.
Exemplo: controller.method.action
if (self::stringStartsWith($methodName, $httpMethod)) {
// NEW CODE
$routeName = strtolower(str_replace('Controller', '', substr($controllerClassName, strrpos($controllerClassName,"\\")+1)));
$routeName .= ".{$httpMethod}.";
$routeName .= str_replace($httpMethod, '', strtolower($methodName));
// END NEW CODE
// CHANGED LINE
Route::$httpMethod($slug_path, $controllerClassName . '@' . $methodName)->name($routeName);
$route = new \stdClass();
$route->httpMethod = $httpMethod;
$route->prefix = sprintf("Route::%-4s('%s',", $httpMethod, $slug_path);
$route->target = $controllerClassName . '@' . $methodName;
$routes[] = $route;
break;
}
@fabiodavel is this request to add a new feature? If this is correct, can you send it as a pull request, as its not clear what is being changed.
PR merged