When executing the command: php artisan larabbs:calculate-active-user, an error is reported: classredisNot found
1. When executing the command: php artisan larabbs:calculate-active-user, an error is reported: classredisnot found. as shown in Figure 1
PS E:\wwwroot\larabbs> php artisan larabbs:calculate-active-user
开始计算...
Error
Class 'Redis' not found
at E:\wwwroot\larabbs\vendor\laravel\framework\src\Illuminate\Redis\Connectors\PhpRedisConnector.php:75
71▕ * @throws \LogicException
72▕ */
73▕ protected function createClient(array $config)
74▕ {
➜ 75▕ return tap(new Redis, function ($client) use ($config) {
76▕ if ($client instanceof RedisFacade) {
77▕ throw new LogicException(
78▕ extension_loaded('redis')
79▕ ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.'
• A class import is missing: You have a missing class import. Try importing this class: `Illuminate\Support\Facades\Redis`.
1 E:\wwwroot\larabbs\vendor\laravel\framework\src\Illuminate\Redis\Connectors\PhpRedisConnector.php:28
Illuminate\Redis\Connectors\PhpRedisConnector::createClient()
2 E:\wwwroot\larabbs\vendor\laravel\framework\src\Illuminate\Redis\Connectors\PhpRedisConnector.php:32
Illuminate\Redis\Connectors\PhpRedisConnector::Illuminate\Redis\Connectors\{closure}()
2. The cache is used in this command, and redis is used as the cache driver. Edit the .dev file and add: redis_client=predis
CACHE_DRIVER=redis
REDIS_CLIENT=predis
3. Execute the command again: php artisan larabbs:calculate-active-user, no more errors are reported. as shown in Figure 2
PS E:\wwwroot\larabbs> php artisan larabbs:calculate-active-user
开始计算...
成功生成!
PS E:\wwwroot\larabbs>

