Skip to content

Commit b9c0f2d

Browse files
committed
fix: Laravel 8 routes fixes
1 parent de64945 commit b9c0f2d

File tree

6 files changed

+4
-27
lines changed

6 files changed

+4
-27
lines changed

src/Commands/Publish/LayoutPublishCommand.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class LayoutPublishCommand extends PublishBaseCommand
3030
public function handle()
3131
{
3232
$this->copyView();
33-
$this->updateRoutes();
3433
$this->publishHomeController();
3534
}
3635

@@ -112,25 +111,6 @@ private function getLocaleViews()
112111
];
113112
}
114113

115-
private function updateRoutes()
116-
{
117-
$path = config('infyom.laravel_generator.path.routes', base_path('routes/web.php'));
118-
119-
$prompt = 'Existing routes web.php file detected. Should we add standard auth routes? (y|N) :';
120-
if (file_exists($path) && !$this->confirmOverwrite($path, $prompt)) {
121-
return;
122-
}
123-
124-
$routeContents = file_get_contents($path);
125-
126-
$routesTemplate = get_template('routes.auth', 'laravel-generator');
127-
128-
$routeContents .= "\n\n".$routesTemplate;
129-
130-
file_put_contents($path, $routeContents);
131-
$this->comment("\nRoutes added");
132-
}
133-
134114
private function publishHomeController()
135115
{
136116
$templateData = get_template('home_controller', 'laravel-generator');
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Route::group(['prefix' => '$RAW_ROUTE_PREFIX$'], function () {
2-
Route::resource('$MODEL_NAME_PLURAL_SNAKE$', '$NAMESPACE_API_CONTROLLER$\$PATH_PREFIX$$MODEL_NAME$APIController');
2+
Route::resource('$MODEL_NAME_PLURAL_SNAKE$', $NAMESPACE_API_CONTROLLER$\$PATH_PREFIX$$MODEL_NAME$APIController::class);
33
});

templates/api/routes/routes.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Route::resource('$MODEL_NAME_PLURAL_SNAKE$', '$NAMESPACE_API_CONTROLLER$\$PATH_PREFIX$$MODEL_NAME$APIController');
1+
Route::resource('$MODEL_NAME_PLURAL_SNAKE$', $NAMESPACE_API_CONTROLLER$\$PATH_PREFIX$$MODEL_NAME$APIController::class);

templates/routes/auth.stub

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Route::group(['prefix' => '$RAW_ROUTE_PREFIX$'], function () {
2-
Route::resource('$MODEL_NAME_PLURAL_CAMEL$', '$NAMESPACE_CONTROLLER$\$PATH_PREFIX$$MODEL_NAME$Controller', ["as" => '$RAW_ROUTE_PREFIX$']);
2+
Route::resource('$MODEL_NAME_PLURAL_CAMEL$', $NAMESPACE_CONTROLLER$\$PATH_PREFIX$$MODEL_NAME$Controller::class, ["as" => '$RAW_ROUTE_PREFIX$']);
33
});

templates/scaffold/routes/routes.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Route::resource('$MODEL_NAME_PLURAL_CAMEL$', '$NAMESPACE_CONTROLLER$\$PATH_PREFIX$$MODEL_NAME$Controller');
1+
Route::resource('$MODEL_NAME_PLURAL_CAMEL$', $NAMESPACE_CONTROLLER$\$PATH_PREFIX$$MODEL_NAME$Controller::class);

0 commit comments

Comments
 (0)