I installed TwigBridge for Laravel 4, and I'm trying to adapt some of the templates that I already have from Blade to Twig.
I want to display some validation errors at the top of the view.
In Blade (which worked fine) I had the following:
@if (isset($errors)) @foreach ($errors->all() as $error) <p>{{ $error }}</p> @endforeach @endif
I tried converting it to Twig but nothing is displayed.
{% if errors %} {% for error in errors %} <p>{{ error }}</p> {% endfor %} {% endif %}
However, if I try:
{{ errors }}
I get some output:
{"name": ["Name field is required." ]}
What do I need to change to make it work?
Any advice is appreciated.
thanks
source share