简体   繁体   English

Class 找不到“路线” laravel 9

[英]Class "Routes" not found laravel 9

Before Everything is working fine,When I added a route Routes::get('orders',[OrderController::class, 'index']);在一切正常之前,当我添加路由Routes::get('orders',[OrderController::class, 'index']); and then I optimize the laravel using php artisan optimize this through an error and I have no idea why it's coming, I double check each and everything but this error is far different from the normal error of importing class and correct routes然后我使用php artisan optimize通过错误优化它,我不知道为什么会这样,我仔细检查了每一个错误,但这个错误与导入 class 和正确路由的正常错误有很大不同

its imported web.php其进口web.php

use Illuminate\Support\Facades\Route;

   


   Error 

  Class "Routes" not found

  at C:\xampp\htdocs\Scripting_Language_project\routes\web.php:87
     83▕     Route::put('update-product/{id}',[ProductController::class , 'update']);
     84▕     Route::get('delete-product/{id}',[ProductController::class , 'delete']);
     85▕     Route::put('update-order/{id}',[UserController::class , 'updateOrder']);
     86▕
  ➜  87▕     Routes::get('orders',[OrderController::class, 'index']);

There are extra 's' in Route . Route中有额外的's'。 Try change to尝试更改为

Route::put('update-order/{id}',[UserController::class , 'updateOrder']);
Route::get('orders',[OrderController::class, 'index']);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM