小编vah*_*ian的帖子

Laravel Request :: is() - 有更好的方法吗?

@if(Request::is('login') OR Request::is('tags') OR Request::is('categories') OR Request::is('posts') OR Request::is('tags/..') OR Request::is('categories/..') OR Request::is('posts/..') OR Request::is("posts/{$post->id}"))
    @include('partials._navAdmin')
  @else  
    @include('partials._nav')
Run Code Online (Sandbox Code Playgroud)

这是我的main.blade.php文件中的一个示例,现在我正在做的是我正在尝试使用2个不同的导航栏 - 我知道有更好的方法来做到这一点但我仍然无法掌握它!

我不认为重复Request ::是一遍又一遍的好编码标准.我是新手:(那边我想念的是什么?

php laravel

10
推荐指数
1
解决办法
9343
查看次数

标签 统计

laravel ×1

php ×1