-2

Help me with this doubt, with zizaco entrust we can only block or give access to pages for a determined user/role that will be defined in the routes or resource routes. We can not block a certain area of a page, correct? Let me try to give an example.

In zizaco entrust we have users, roles and permissions. In my view (index.blade.php), i have 3 buttons (show, edit,delete). Can i do something like: The user "A" with role "user" and permission "read", will only view the show button?

SlimBoy
  • 311
  • 2
  • 4
  • 14

1 Answers1

0

Found out how i can do this, for those that dont know this is my solution:

in my blade page:

    <?php 
      if (Auth::user()->ability('Admin',array('read_col_x'),$options = array('validate_all' => true))) {
        echo("<li><a href='#'><span class='glyphicon glyphicon-certificate'></span> Col_X</a></li>");
      }
    ?>

Admin is the Role, read_col_x is the permission, with this any user that have the role 'Admin' and permission 'read_col_x' can see that element

SlimBoy
  • 311
  • 2
  • 4
  • 14