iqbalchandra dewangga
iqbalchandra dewangga

Reputation: 21

Error Class 'Illuminate\Support\Facades\RateLimiter' not found

After i install composer require there some error Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi

Error

Class 'Illuminate\Support\Facades\RateLimiter' not found

at C:\laragon\www\iqbalchandra-bwaStore\app\Providers\RouteServiceProvider.php:59 55| * @return void 56| */ 57| protected function configureRateLimiting() 58| {

59| RateLimiter::for('api', function (Request $request) { 60| return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip()); 61| }); 62| } 63| }

1 C:\laragon\www\iqbalchandra-bwaStore\app\Providers\RouteServiceProvider.php:38 App\Providers\RouteServiceProvider::configureRateLimiting()

2 C:\laragon\www\iqbalchandra-bwaStore\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36 App\Providers\RouteServiceProvider::boot() Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

i dont know how to fix it

Upvotes: 0

Views: 1520

Answers (2)

Ian Munge
Ian Munge

Reputation: 37

Check if you have use Illuminate\Support\Facades\RateLimiter; in your app/Providers/RouteServiceProvider.php class.

I had the same problem when upgrading from laravel 7 to laravel 8. This article helped. https://www.amitmerchant.com/new-ratelimiter-facade-in-laravel-8/

Upvotes: 0

Maksim
Maksim

Reputation: 2957

At app/Providers/RouteServiceProvider.php add to file top:

<?php
namespace App\Providers;

use Illuminate\Support\Facades\RateLimiter;

Upvotes: 0

Related Questions