How can I get the current view name inside a master layour in Laravel 4?

后端 未结 2 976
忘掉有多难
忘掉有多难 2021-01-19 17:37

in Laravel 4 I have a master blade layout and I want to add a class to the html element like \'tpl-home\', but I need to know which is the current view name called with View

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-19 18:03

    View Composers are a great way to keep/share variables in views, but the names of the views set in routes file are more a fixed value in each view than a variable, that's why, in this case,

    I'd rather use Request::path() == 'viewName' in Blade like this:

提交回复
热议问题