Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I just upgraded from Laravel 6 to 8 and now I am getting the following error when running php artisan optimize:

Unable to prepare route [post] for serialization. Another route has already been assigned name [post.index].

Here is what my web.php file looks like:

$Routes = function() {
    Route::get('/about', 'SinglePageController@about');
    Route::post('login', 'AuthLoginController@login');

    Route::resource('/post', 'PostController');
};


Route::group(['middleware' => 'impersonate','domain' => '127.0.0.1'], $Routes);
Route::group(['middleware' => 'impersonate','domain' => '127.0.0.2'], $Routes);

If I comment out the Route::resource or one of the Route::group lines it works with the limited functionality.

question from:https://stackoverflow.com/questions/65946417/unable-to-prepare-route-after-upgrading-from-laravel-6-to-8

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
439 views
Welcome To Ask or Share your Answers For Others

1 Answer

Not sure if it is the best solution, but the following routes worked.

Route::middleware(['impersonate'])->domain('127.0.11.1')->name('admin.')->group($Routes);
Route::middleware(['impersonate'])->domain('127.0.11.2')->name('viewer.')->group($Routes);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...