访问 Laravel 中的配置变量

Accessing config variable in Laravel

在我的配置文件夹下有一个 constants.php 文件。我已经使用 {{ json_encode(config('constants.pressMetadata')) }} 访问了常量文件中的 pressMetadata 对象。这会将所有数据转储为 JSON 对象。我想要做的是使用 foreach 循环打印出所有数据。我试过了

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

这不起作用。那么我应该怎么做才能使用 foreach 循环遍历 config('constants.pressMetadata')?

处的对象

这里是常量pressMetadata

'pressMetadata'=>[
      "AARP" => [
          "id" => 1,
          "company" => "AARP",
          "title" => "Updating Your Résumé for the Digital Age",
          "url" => "http://www.aarp.org/work/job-hunting/info-2016/give-resume-a-digital-reboot.html",
          "date" => "Sep 9, 2016"
      ],
      "Business Insider" => [
          "id" => 2,
          "company" => "Business Insider",
          "title" => "8 things you should always include on your résumé",
          "url" => "http://www.businessinsider.com/what-to-always-include-on-your-resume-2016-1",
          "date" => "Jan 28, 2016"
      ],
      "Morning Journal" => [
          "id" => 3,
          "company" => "Morning Journal",
          "title" => "5 things you missed: Google updates search, Jobscan and more",
          "url" => "http://www.morningjournal.com/article/MJ/20140124/NEWS/140129366",
          "date" => "Jan 24, 2014"
      ],
],

因为它是数组的数组,所以这样做:

@foreach (config('constants.pressMetadata') as $tile)
    <p>{{ $tile['id'] }}</p>
@endforeach