5
<?php echo Form::open(['method' => 'POST', 'url' => ['/cart/add/'. "{{$product->product_id }}"]] )?>
<?php echo Form::button('Agregar al Carro', ['class' => 'btn-u btn-u-sea-shop btn-u-lg', 'type' => 'submit']) ?>
<?php echo Form::close()  ?>

I need to print the variable $product in a template.

Paolo Forgia
  • 6,572
  • 8
  • 46
  • 58

2 Answers2

7

You can echo it with php like:

<?php echo $product->product_id ?>

and in blade syntax like:

{{$product->product_id}}

and in your case it should be like:

'url' => [ '/cart/add/'. $product->product_id ]

only concatenation is required here

Mayank Pandeyz
  • 25,704
  • 4
  • 40
  • 59
0

you can print variable like that in blade

{{$product}}

see for more details in laravel official site

Shailesh Ladumor
  • 7,052
  • 5
  • 42
  • 55