如果 url 是 /login 或 /auth/reset-password,我想通过添加 auth-container 类来有条件地在我的 Blade body 标记中添加 css 类
所以我有
<body> //here add class
Run Code Online (Sandbox Code Playgroud)
所以我尝试过
@if(in_array( , ['login','/auth/reset-password']) )//stuck here
<body class="auth-container">
@else()
<body> //no class
@endif()
Run Code Online (Sandbox Code Playgroud)
我陷入了如何确定 url 是否/login or /auth/reset-password因此添加类的困境auth-container
请求中的方法is可以检查 url 是否与模式匹配。您可以使用 * 字符作为通配符:
<body @if(Request::is('login/*') || Request::is('auth/reset-password')) class="auth-container" @endif>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6458 次 |
| 最近记录: |