curtisblackwell / laravel-blade-directive-yaml-injector
您的包的功能简短描述
1.0.0
2017-04-20 20:31 UTC
Requires
- php: >=5.6.4
- illuminate/support: 5.4.*
- symfony/yaml: 3.2.*
This package is not auto-updated.
Last update: 2024-09-29 02:44:31 UTC
README
此包允许您将 YAML 数据注入到您的视图中。
安装
composer require curtisblackwell/laravel-blade-directive-yaml-injector
使用方法
@yaml('myVar', 'my-yaml-file')
示例
// config/app.php 'providers' => [ ... CurtisBlackwell\YamlInjectionProvider::class, ... ],
@yaml('bowie', 'david-bowie') <table> <thead> <tr> <th>Year</th> <th>Title</th> </tr> </thead> <tbody> @foreach($bowie['albums'] as $album) <tr> <td>{{ $album['year'] }}</td> <td>{{ $album['title'] }}</td> </tr> @endforeach </tbody> </table>
# resources/views/david-bowie.yaml albums: - title: Self-titled year: 1967 - title: Self-titled year: 1969 - title: The Man Who Sold the World year: 1970 - title: Hunky Dory year: 1971 - title: The Rise and Fall of Ziggy Stardust and the Spiders from Mars year: 1972