whitecube / nova-page

Static pages content management for Laravel Nova
https://whitecube.github.io/nova-page
MIT License
238 stars 41 forks source link

If Statements around fields in blade templates #38

Closed DCReddish97 closed 5 years ago

DCReddish97 commented 5 years ago

I'm trying to set an IF statement around the fields pulled through Nova-page tool

e.g @if (!empty(Page::get('sub_title'))))

But everything I'm trying just seems to be ignored and Laravel throws an error if the field is left empty.

voidgraphics commented 5 years ago

Since 7c9d47f86b8d76218538634d49e2278fe8f6820f it should not throw an exception by default anymore (see https://github.com/whitecube/nova-page/issues/31#issuecomment-495183748) and just fail silently. However I'm noticing that a proper release including these changes has not been published yet and is still in draft status. I suppose you can try changing your version to dev-master if this is an urgent matter, but I recommend you hang on until we can get around to finishing that release properly.

I will tag @Nyratas in here so he doesn't lose sight of this.

Edit: I should also probably mention that an if statement is not comparable to a try/catch statement which is what you need when you're dealing with exceptions.