Your cart
  • IMG
    {{cart_item.name}}
    {{cart_item.variation_attribute_name}}: {{cart_item.variation_attribute_label}}
    {{cart_item.item_unit}}: {{ setCurrency(cart_item.price)}}
    {{ setCurrency(cart_item.price*cart_item.quantity)}}
    Invalid quantity more than stock
Total :
{{setCurrency(cart.sub_total)}}

There is no item in the cart. If you want to buy, Please click here.

Step 3: Set authentication for action or controller

Complete Application using Grails 3

Created by :
Grails
tutorial
Programming, Software and application
1095
2020-10-14 16:12:27

You can set authentication in route for specific action as bellows

Route::get('profile', function () {
    // Only authenticated users may enter...
})->middleware('auth');

Of course, if you are using controllers, you may call the middleware method from the controller's constructor instead of attaching it in the route definition directly:

public function __construct()

{

   $this->middleware('auth');

}

Still now, contact all action is public and accessible without login. We want to set authentication for all action contact list, edit, delete except create just updating contact controller which is as bellow:

public function __construct() {

       $currentAction = Route::getCurrentRoute()->getName();

       if ($currentAction == 'contact.create' || $currentAction == 'contact.store') {

       } else {

           $this->middleware('auth');

       }

}