Reputation: 2702
I am trying to store an array in a config file `config/project_specific.php
<?php
return [
'sluggable_models1' => 'test_value', // works
'sluggable_models2' => ['features','packages'], // throws error
];
I call this value by $models = config('project_specific.sluggable_models')
in my controller
as long as the variable is a string, it works. When the value is an array type, i get this error ErrorException in helpers.php line 515: htmlentities() expects parameter 1 to be string, array given (View: \resources\views\starter\admin\dashboard_admintools.blade.php)
how I can store a sitewide accessible array in my Laravel 5.3 app? Not necesarily a config file, but I prefer to avoid a DB-fed solution.
Upvotes: 0
Views: 375
Reputation: 3819
The error seems to indicate the array is making it to your view just fine but you are trying to print the variable in your blade template vs. looping over it.
{{ }} is essentially the same as echo but it tries to escape the string using htmlentities(), hence the error.
Upvotes: 1