i have a specific issue for my view about show or not add to cart.First of all i have the view in that way that the previous route is always the same, so i cant check it. I have 2 different routes going on product. If clicking directly form the nav bars, i don't want to show add to cart, because it is like a gallery for the products, and the second route is going to product for booking after completing the booking form and here i want to show add to cart. I have done something with checking the sessions but it is not working. Can you please take a look. Thanks in advance. This is my controller:
public function index($id)
{
$menu_categories = Menu_Categories::where('visible','yes')->where('delete','no')->orderBy('position','ASC')->get();
$selected_menu = $id;
$dishes = Dishes::where('visible','yes')->where('delete','no')->where('id_menu_category',$id)->orderBy('name','DESC')->get();
return view('dishes.dishes', ['dishes' => $dishes,'menu_categories' => $menu_categories,'selected_menu' => $selected_menu]);
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index_nav($id)
{
$menu_categories = Menu_Categories::where('visible','yes')->where('delete','no')->orderBy('position','ASC')->get();
$selected_menu = $id;
$dishes = Dishes::where('visible','yes')->where('delete','no')->where('id_menu_category',$id)->orderBy('name','DESC')->get();
session(['menu_nav' => true]);
return view('dishes.dishes', ['dishes' => $dishes,'menu_categories' => $menu_categories,'selected_menu' => $selected_menu]);
}
And this is my view:
@foreach($dishes as $dish)
<!-- shop item -->
<div class="col-md-6 col-sm-6">
<div class="home-product text-center position-relative overflow-hidden margin-ten no-margin-top">
<a href=""><img height="300" style="height:250px;width: 100%" src="" alt=""/></a>
<span class="product-name text-uppercase black-text" ><a style="font-weight: bold; background-color: #FFFFFF;border: 1px solid white"></a></span>
<span class="price black-text"> €</span>
<div class="quick-buy" style="width:100px;height:100px;margin-left:150px;">
<div class="product-share">
@if(Session::has('manu_nav') && Session::get('manu_nav') == true)
@else
<a href="" class="highlight-button-dark btn btn-small no-margin-right quick-buy-btn" title=""><i class="fa fa-shopping-cart"></i></a>
@endif
</div>
</div>
</div>
</div>
<!-- end shop item -->
@endforeach
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2jibGQO
via IFTTT
Aucun commentaire:
Enregistrer un commentaire