The problem is that you're using blade inside blade:
\/ \/
{{ Form::text('id', {{ request('id') }} , array('class' => 'form-control')) }}
And this is not accepted obviously.
You must keep in mind that once you open a blade tag {{
, the blade will translate it to this:
<?php echo Form::text('id', {{ request('id') }} , array('class' => 'form-control')) ?>
Note that it doesn't work recursively, so the second level blade tag will not be translated, and {
is a invalid character inside a PHP code.
To solve it, you shouldn't (and needn't) use the second level blade tag:
{{ Form::text('id', request('id'), array('class' => 'form-control')) }}
Of course, I'm assuming that the request()
function exists, otherwise it will throw an error: Call to undefined function request()
.
To solve your problem (not the error), you should use the old()
method instead of request()
, since it uses the value stored by Laravel on session.
Note that this approach works in two situations:
- When a validation error occurs.
- When you have flashed the fields manually.
This behaviors are described here on Laravel Docs