0
{{Form::label('listing', 'Price:')}}
{{Form::text('price','' , ['class' => 'form-control', 'placeholder' => 'Price'])}}

I would like to pre-fill the form with value {{listing->price}} from the database

{{Form::label('listing', 'Price:')}}
{{Form::text('price','{{listing->price}}' , ['class' => 'form-control', 'placeholder' => 'Price'])}}

ERROR: Parse error: syntax error, unexpected '}', expecting ',' or ')'

Is this a good fix? Setting a variable and parsing it in

$f = ($listing->price);
echo('{{Form::text('price',.$f. , ['class' => 'form-control', 'placeholder' => 'Price'])}}')
tk3
  • 990
  • 1
  • 13
  • 18
user9820353
  • 111
  • 1
  • 11

1 Answers1

0

Escape your quotes:

    echo '{{Form::text(\'price\','.$f.' , [\'class\' => \'form-control\', \'placeholder\' => \'Price\'])}}';
Kalamun
  • 429
  • 4
  • 10