rtmatt / body-class
laravel 5 的快速浏览器 body 类服务提供商
1.0.1
2016-02-03 18:42 UTC
Requires
- php: >=5.3.0
- jenssegers/agent: ^2.3
This package is not auto-updated.
Last update: 2024-09-14 18:31:36 UTC
README
Laravel 服务提供程序,基于 Agent 构建,用于向 body HTML 标签添加浏览器类。
安装
使用 composer 进行安装
$ composer require rtmatt/body-class
将服务提供程序添加到 config/app.php
Rtmatt\BodyClass\BodyClassServiceProvider::class
使用方法
这需要您的布局文件为 /resources/views/layouts/main.blade.php
。未来可能会支持多个或其他布局。
在上面的文件中,将以下内容添加到您的 body 标签中
<body{!! ($body_class) ? ' class="'.$body_class.'"' : '' !!}>
一切就绪!