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::make.
<!doctype html>
<html lang="es" class="tpl-{{Str::slug($currentViewName)}}">
Does Laravel provide any function for retrieving this?
Thanks
Inside your filters file place:
View::composer('*', function($view){
View::share('view_name', $view->getName());
});
Then in your master blade layout you can access it as $view_name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With