You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
php artisan config:cache not work because of closure's used in config files.
In Laravel, configuration files are meant to be simple PHP arrays, and they are loaded very early in the application's lifecycle. This means that the service container (which is responsible for resolving and managing class dependencies) is not yet fully available when configuration files are loaded. Therefore, you can't directly access the service container within configuration files.
If you need to access dynamic values from the service container and want to ensure they are only computed or resolved when needed, a good approach is to use closures or functions within the configurations that are evaluated at runtime. This means moving the logic that depends on the service container to the place where these values are actually used.
To Reproduce
Steps to reproduce the behavior:
Install fresh Bagisto
Execute php artisan config:cache
See error
Expected behavior
Caching config values without errors.
Screenshots
Lines that causes the error :
packages/Admin/src/config/system.php
The text was updated successfully, but these errors were encountered:
Describe the bug
php artisan config:cache not work because of closure's used in config files.
In Laravel, configuration files are meant to be simple PHP arrays, and they are loaded very early in the application's lifecycle. This means that the service container (which is responsible for resolving and managing class dependencies) is not yet fully available when configuration files are loaded. Therefore, you can't directly access the service container within configuration files.
If you need to access dynamic values from the service container and want to ensure they are only computed or resolved when needed, a good approach is to use closures or functions within the configurations that are evaluated at runtime. This means moving the logic that depends on the service container to the place where these values are actually used.
To Reproduce
Steps to reproduce the behavior:
php artisan config:cache
Expected behavior
Caching config values without errors.
Screenshots
Lines that causes the error :
packages/Admin/src/config/system.php
The text was updated successfully, but these errors were encountered: