<section class="padd-tb-60 bg-dark image-v2 bg-fixed"> <div class="container"> <div class="row"> <div class="col-md-4 col-md-offset-4"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Product Details</h3> </div> <div class="panel-body"> <?php $supplier = Suppliers::find($product->supplierId); $category = Categories::find($product->categoryId); ?> <p>Product ID: {{$product->supplierProductId}}</p> <p>Name: {{$product->name}}</p> <p>Supplier: {{$supplier->name}}</p> <p>Category: {{$category->name}}</p> <p>Cost: {{$product->unitPrice}}</p> <p>Quantity: {{$product->quantity}}<br></p> <p>Color is: {{$product->color}}</p> <p>Description is: {{$product->details}}</p> <div class="padd-t-20"> <a class="btn btn-small btn-green" href="{{ URL::to('suppliers/' . $product->id . '/edit') }}">Edit</a> {{ Form::open(array('url' => 'products/' . $product->id, 'class' => 'pull-right')) }} {{ Form::hidden('_method', 'DELETE') }}
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { if (!$id) { return Redirect::route('suppliers.index')->with('error', 'Please provide Supplier id'); } $supplier = Suppliers::find($id); if (empty($supplier)) { return Redirect::route('suppliers.index')->with('error', 'Supplier not found'); } Suppliers::destroy($id); return Redirect::route('suppliers.index')->with('success', 'Supplier deleted successfully'); }
<thead> <tr> <th><h4>Name</h4></th> <th><h4>Cost</h4></th> <th><h4>Supplier</h4></th> <th><h4>Category</h4></th> <th><h4>Quantity</h4></th> <th><h4>Colour</h4></th> <th><h4>Status</h4></th> </tr> </thead> <tbody> @foreach($products as $key => $value) <tr> <?php $supplier = Suppliers::find($value->supplierId); $category = Categories::find($value->categoryId); ?> <td style="width:15%"><strong>{{ $value->name }}</strong></td> <td style="width:15%">{{ $value->unitPrice}}</td> <td style="width:15%">{{ $supplier->name}}</td> <td style="width:15%">{{ $category->name}}</td> <td style="width:15%">{{ $value->quantity}}</td> <td style="width:10%">{{ $value->color}}</td> <td style="width:5%"><a class="btn btn-small btn-blue" href="{{ URL::to('products/' . $value->id . '/details') }}">Details</a></td> <td style="width:5%"><a class="btn btn-small btn-green" href="{{ URL::to('products/' . $value->id . '/edit') }}">Edit</a></td> <td style="width:5%"> {{ Form::open(array('url' => 'products/' . $value->id, 'class' => 'pull-right')) }} {{ Form::hidden('_method', 'DELETE') }} {{ Form::submit('Delete', array('class' => 'btn btn-danger', 'onclick' => 'return confirm("Are you sure you want to delete this product?")')) }} {{ Form::close() }}
public function details($id) { $supplier = Suppliers::find($id); return View::make('suppliers.details')->with('supplier', $supplier); }