I am trying to display all orders in database based on selected option. The two options are Accepted and Declined. I have a an orders table with column "status"
On my view i am displaying all orders, this is ok. I want to also display data based on status at the top. Help is much appreciated.
My View:
<h1 class="text text-center">Orders Page</h1>
<div class="panel panel-warning">
<div class="panel-heading">
<p>Returning an array of all orders, filtered by status</p>
<select>
<option>Accepted</option>
<option>Declined</option>
</select>
</div>
<div class="panel-body">
Display Data here
</div>
</div>
@foreach ($orders as $order)
<div class="panel panel-primary">
<div class="panel panel-heading">
<p>Order Number: for retailerr: </p>
</div>
<div class="panel panel-body">
<p>The Status of this order: @if ($order->status == '') <span style="color: red"> Pending approval </span>@else @endif</p>
<p><a href="" class="btn btn-primary">Change Order Status</a>
<a href="" class="btn btn-success">View Order Details</a>
{!! Form::open(array("method"=>"DELETE", "url"=>"orders/$order->id")) !!}
{!! Form::submit("Delete Order", array("class"=>"btn btn-danger")) !!}
{!! Form::close() !!}</p>
<p>The total for this order: </p>
</div>
<div>
<h5 class="text-center">Order by: </h5>
</div>
</div>
@endforeach
Controller Index Method:
public function index()
{
//
$data = Order::all();
return view('orders.orderDashboard')->with("orders", $data);
}
via Jay240692