I have an "artist" resource, and on the show route page I have a form. I am using Laravel Blade syntax. As part of this form, I am trying to send the page ID to the back end of a Laravel 4 project. I am doing it this way:
{{Form::hidden('artist-id',null, array(
'id' => '{{$artist->id}}',
));}}
However, when using this, the browser throws an error, because it is not rendering the $artist->id variable within the brackets before the outside brackets of the input form.
Is there a way around this or another way to pass back this variable for the resource? Thank you!
You don't need to nest your blade call like that, this should work:
So anything inside the blade tags
{{ }}
is treated as standard PHP. Using further{{ }}
inside existing blade tags is just going to throw a big error.Because anything inside the blade tags is treated as PHP you can simply do the following
Although posting that input isn't going to give you the value you want, because the value supplied is
null
. The id attribute is the html ID given to the html attribute. You need the following to set the value on the input, which will then be posted in with your form data