Laravel 5.2、file_get_contents 对所有文件进行循环。 blade 怎么样?

Laravel 5.2, file_get_contents with looping for all files. How with blade?

我想把文件的全部内容 resources\views\angularTemplates 文件夹

我之前用 asset() 函数为单个文件做过类似的事情:

<script type="text/ng-template" id="defult-icons">
  {!! file_get_contents(asset('assets/img/defult_icons.svg')); !!}
</script>

但现在我想在 resources\views

中创建 整个文件夹

并进入循环中的每个交互 - 当前文件的名称

这样说:

  @loop('views\angularTemplates', $file_name, $file_content)

    <script type="text/ng-template" id="{!! $file_name !!}">  
        {!! $file_content !!}
    </script>

  @endloop

有一种方法可以用 blade 方式做到这一点吗?

最后我这样做了。如果有人会:

   <?php

      $path = base_path('resources\views\includes\angular-templates\');
      $templates = File::allFiles($path);

    ?>

    @foreach ($templates as $template)

        <script type="text/ng-template" id="{!! $template->getBasename() !!}">
          {!! file_get_contents( $path . $template->getBasename() ) !!}
        </script>

    @endforeach