mercredi 24 août 2016

array variable available sitewide in a custom configuration file - Laravel

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

problem

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)

to do

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.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire