lundi 5 mars 2018

Laravel - Select product and go to next step

I'm trying to make a little product select system where a user can select a product, click on the button above and move on to the next step. But how can I make that work?

In my view, I have a simple foreachloop which displays all the products. This is the view

@section('content')
<div class="container">
  <div class="row mb-4">
    <div class="col-md-12 text-right">
        <a href="" class="btn btn-primary">Next step</a>
    </div>
  </div>
<div class="row">
    @foreach($products as $product)
    <div class="col-md-4">
        <a href="" class="anchor-tag">
            <div class="card product-card mb-4">
                <div class="card-header">
                    <h5 class="m-0"></h5>
                </div>
                <div class="card-body" style="height: 200px">
                    <p class="m-0"></p>
                </div>
                <div class="card-footer">
                    <div class="row">
                        <div class="col-md-8">
                            <small>Author: </small>
                            <br>
                            <small>Price: € </small>
                        </div>
                        <div class="col-md-4">
                            <small class="float-right">Version: </small>
                        </div>
                    </div>
                </div>
            </div>
        </a>
    </div>
    @endforeach
  </div>
</div>
@endsection

As you can see in at the top of the view I have a button which says Next step. I want to give the selected product's information to that button, by using something like this

But I can't because the product is not defined outside of the loop. How can I make the select system work?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2H1AyUP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire