简体   繁体   中英

Class "Routes" not found laravel 9

Before Everything is working fine,When I added a route 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

its imported 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 . Try change to

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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