bavix / laravel-wallet

It's easy to work with a virtual wallet
https://bavix.github.io/laravel-wallet/
MIT License
1.14k stars 230 forks source link

Call to undefined method Illuminate\Support\Facades\Cache::store() #742

Closed seerbit-developers closed 1 year ago

seerbit-developers commented 1 year ago

Describe the bug I upgraded from version 5.8 Lumen to version 10 and i get this errors.

**Trace Error**
[2023-08-16 21:38:19] develop.ERROR: Call to undefined method Illuminate\Support\Facades\Cache::store() {"exception":"[object] (Error(code: 0): Call to undefined method Illuminate\\Support\\Facades\\Cache::store() at /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/bavix/laravel-wallet/src/WalletServiceProvider.php:295)
[stacktrace]
#0 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(908): Bavix\\Wallet\\WalletServiceProvider->Bavix\\Wallet\\{closure}(Object(Laravel\\Lumen\\Application), Array)
#1 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(795): Illuminate\\Container\\Container->build(Object(Closure))
#2 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(731): Illuminate\\Container\\Container->resolve('Bavix\\\\Wallet\\\\In...', Array)
#3 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Application.php(327): Illuminate\\Container\\Container->make('Bavix\\\\Wallet\\\\In...', Array)
#4 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(1066): Laravel\\Lumen\\Application->make('Bavix\\\\Wallet\\\\In...')
#5 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(982): Illuminate\\Container\\Container->resolveClass(Object(ReflectionParameter))
#6 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(943): Illuminate\\Container\\Container->resolveDependencies(Array)
#7 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(795): Illuminate\\Container\\Container->build('Bavix\\\\Wallet\\\\In...')
#8 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(731): Illuminate\\Container\\Container->resolve('Bavix\\\\Wallet\\\\In...', Array)
#9 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Application.php(327): Illuminate\\Container\\Container->make('Bavix\\\\Wallet\\\\In...', Array)
#10 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(796): Laravel\\Lumen\\Application->make('Bavix\\\\Wallet\\\\In...')
#11 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(731): Illuminate\\Container\\Container->resolve('Bavix\\\\Wallet\\\\In...', Array)
#12 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Application.php(327): Illuminate\\Container\\Container->make('Bavix\\\\Wallet\\\\In...', Array)
#13 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(1066): Laravel\\Lumen\\Application->make('Bavix\\\\Wallet\\\\In...')
#14 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(982): Illuminate\\Container\\Container->resolveClass(Object(ReflectionParameter))
#15 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(943): Illuminate\\Container\\Container->resolveDependencies(Array)
#16 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(795): Illuminate\\Container\\Container->build('Bavix\\\\Wallet\\\\Se...')
#17 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(296): Illuminate\\Container\\Container->resolve('Bavix\\\\Wallet\\\\Se...', Array, false)
#18 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(908): Illuminate\\Container\\Container->Illuminate\\Container\\{closure}(Object(Laravel\\Lumen\\Application), Array)
#19 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(795): Illuminate\\Container\\Container->build(Object(Closure))
#20 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(731): Illuminate\\Container\\Container->resolve('Bavix\\\\Wallet\\\\Se...', Array)
#21 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Application.php(327): Illuminate\\Container\\Container->make('Bavix\\\\Wallet\\\\Se...', Array)
#22 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(1066): Laravel\\Lumen\\Application->make('Bavix\\\\Wallet\\\\Se...')
#23 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(982): Illuminate\\Container\\Container->resolveClass(Object(ReflectionParameter))
#24 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(943): Illuminate\\Container\\Container->resolveDependencies(Array)
#25 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(795): Illuminate\\Container\\Container->build('Bavix\\\\Wallet\\\\Se...')
#26 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(296): Illuminate\\Container\\Container->resolve('Bavix\\\\Wallet\\\\Se...', Array, false)
#27 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(908): Illuminate\\Container\\Container->Illuminate\\Container\\{closure}(Object(Laravel\\Lumen\\Application), Array)
#28 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(795): Illuminate\\Container\\Container->build(Object(Closure))
#29 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(731): Illuminate\\Container\\Container->resolve('Bavix\\\\Wallet\\\\Se...', Array)
#30 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Application.php(327): Illuminate\\Container\\Container->make('Bavix\\\\Wallet\\\\Se...', Array)
#31 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/helpers.php(42): Laravel\\Lumen\\Application->make('Bavix\\\\Wallet\\\\Se...', Array)
#32 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/bavix/laravel-wallet/src/Traits/HasWallet.php(67): app('Bavix\\\\Wallet\\\\Se...')
#33 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php(657): App\\Business->getBalanceAttribute(NULL)
#34 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php(2097): Illuminate\\Database\\Eloquent\\Model->mutateAttribute('balance', NULL)
#35 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php(488): Illuminate\\Database\\Eloquent\\Model->transformModelValue('balance', NULL)
#36 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/database/Eloquent/Concerns/HasAttributes.php(442): Illuminate\\Database\\Eloquent\\Model->getAttributeValue('balance')
#37 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/database/Eloquent/Model.php(2225): Illuminate\\Database\\Eloquent\\Model->getAttribute('balance')
#38 /Users/victor/Documents/valet-sites/easypay-api-v1/app/Http/Controllers/AgentController.php(28): Illuminate\\Database\\Eloquent\\Model->__get('balance')
#39 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/BoundMethod.php(36): App\\Http\\Controllers\\AgentController->balance(Object(Laravel\\Lumen\\Http\\Request))
#40 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#41 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#42 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Laravel\\Lumen\\Application), Array, Object(Closure))
#43 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/container/Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Laravel\\Lumen\\Application), Array, Array, NULL)
#44 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(391): Illuminate\\Container\\Container->call(Array, Array)
#45 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(376): Laravel\\Lumen\\Application->callControllerCallable(Array, Array)
#46 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(48): Laravel\\Lumen\\Application->Laravel\\Lumen\\Concerns\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#47 /Users/victor/Documents/valet-sites/easypay-api-v1/app/Http/Middleware/AgentMiddleware.php(38): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#48 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/pipeline/Pipeline.php(180): App\\Http\\Middleware\\AgentMiddleware->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#49 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#50 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/pipeline/Pipeline.php(116): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#51 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(428): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#52 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(375): Laravel\\Lumen\\Application->sendThroughPipeline(Array, Object(Closure))
#53 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(352): Laravel\\Lumen\\Application->callLumenControllerWithMiddleware(Object(App\\Http\\Controllers\\AgentController), 'balance', Array, Array)
#54 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(331): Laravel\\Lumen\\Application->callLumenController(Object(App\\Http\\Controllers\\AgentController), 'balance', Array)
#55 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(284): Laravel\\Lumen\\Application->callControllerAction(Array)
#56 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(269): Laravel\\Lumen\\Application->callActionOnArrayBasedRoute(Array)
#57 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(171): Laravel\\Lumen\\Application->handleFoundRoute(Array)
#58 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(48): Laravel\\Lumen\\Application->Laravel\\Lumen\\Concerns\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#59 /Users/victor/Documents/valet-sites/easypay-api-v1/app/Http/Middleware/CorsMiddleware.php(23): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#60 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/pipeline/Pipeline.php(180): App\\Http\\Middleware\\CorsMiddleware->handle(Object(Laravel\\Lumen\\Http\\Request), Object(Closure))
#61 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Routing/Pipeline.php(30): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#62 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/illuminate/pipeline/Pipeline.php(116): Laravel\\Lumen\\Routing\\Pipeline->Laravel\\Lumen\\Routing\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#63 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(428): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#64 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(167): Laravel\\Lumen\\Application->sendThroughPipeline(Array, Object(Closure))
#65 /Users/victor/Documents/valet-sites/easypay-api-v1/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(112): Laravel\\Lumen\\Application->dispatch(NULL)
#66 /Users/victor/Documents/valet-sites/easypay-api-v1/public/index.php(28): Laravel\\Lumen\\Application->run()
#67 {main}
"} 

Server:

rez1dent3 commented 1 year ago

Hello. Thanks for the interesting question. I found the problem and came up with a solution. You need to add two lines to bootstrap/app.php:

\Illuminate\Support\Facades\Cache::setApplication($app);
$app->registerDeferredProvider(\Illuminate\Cache\CacheServiceProvider::class);

Now I will update the lumen section in the documentation

Screenshot 2023-08-17 at 18 34 09
rez1dent3 commented 1 year ago

@seerbit-developers Hello. Did you succeed?

rez1dent3 commented 1 year ago

@seerbit-developers Hello. I am closing the issue. If the problem is not solved, then write in this issue mentioning me (@rez1dent3).

seerbit-developers commented 1 year ago

Hello @rez1dent3 thank you. The current issue was resolved but another one came up

Bavix\Wallet\Internal\Service\StorageService::get(): Argument #1 ($uuid) must be of type string, null given

rez1dent3 commented 1 year ago

@seerbit-developers You are missing some migrations. You need to upgrade step by step.

rez1dent3 commented 1 year ago

https://bavix.github.io/laravel-wallet/#/upgrade-guide

rez1dent3 commented 1 year ago

@seerbit-developers Additionally, check the table structure. The tables must exactly match the package migrations. https://github.com/bavix/laravel-wallet/blob/master/database/2018_11_06_222923_create_transactions_table.php https://github.com/bavix/laravel-wallet/blob/master/database/2018_11_07_192923_create_transfers_table.php https://github.com/bavix/laravel-wallet/blob/master/database/2018_11_15_124230_create_wallets_table.php https://github.com/bavix/laravel-wallet/blob/master/database/2021_11_02_202021_update_wallets_uuid_table.php

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 7 days with no activity.