Skip to content
Advertisement

Laravel – Check if @yield empty or not

Is it possible to check into a blade view if @yield have content or not?

I am trying to assign the page titles in the views:

JavaScript

So I would like to check in the main layout view… something like:

JavaScript

Advertisement

Answer

There is probably a prettier way to do this. But this does the trick.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement