Monday, April 10, 2017

Accessing config variable in Laravel

Under my config folder I have a constants.php file. I have accessed pressMetadata object in the constant file using . This dumps all the data as a JSON object. What I am trying to do is print out all the data using a foreach loop. I have tried

@foreach (config('constants.pressMetadata') as $tile)
          <p></p>
@endforeach

This does not work. So what should I do so I can use a foreach loop to iterate through the object at config('constants.pressMetadata')?



via Aaron

Advertisement