Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not trample database.database config parameter #137

Open
ftrotter opened this issue Jan 24, 2021 · 1 comment
Open

Do not trample database.database config parameter #137

ftrotter opened this issue Jan 24, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ftrotter
Copy link
Contributor

I am trying to access the function config('database.database'); in a Zermelo report.
That should be returning the values from the Zermelo app.. and not the value from Zermelo.. .

Right now it returns '_zermelo_cache' which is obviously being set somewhere in zermelo...

-FT

@ftrotter ftrotter added the bug Something isn't working label Jan 24, 2021
@kchapple
Copy link
Contributor

Hi @ftrotter,

I may be misunderstanding the issue, but this is what I found.

I created a test report in LoreCommander TEST_ConfigAccess.php so I could look inside the database config variable, from within a Zermelo report. I accessed it like this:

$database = config('database');

I can see that the database config variable is a nested array structure and it's top-level keys are "connections", "default" and "migrations".

Screen Shot 2021-01-25 at 1 33 53 PM

I think the config param you may be looking for is the default database configured in the .env variable, or in the mysql connection section? To access that database's parameters, you could do something like this:

$database_config = config('database');
$default_connection_name = $database_config['default'];
$my_database = $database["connections"][$default_connection_name];

I changed the cache table config in config/zermelo.php to be _zermelo_cache_2 and confirmed that the database in the config was changed also (expected.)

Screen Shot 2021-01-25 at 1 40 57 PM

Let me know if this clears anything up, or if the issue isn't covered by my explanation.

Ken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants