<?php
$edit = array_filter($user_permission, function ($item) {
    return isset($item['method']) && $item['method'] === 'edit';
});

$view = array_filter($user_permission, function ($item) {
    return isset($item['method']) && $item['method'] === 'view';
});

$delete = array_filter($user_permission, function ($item) {
    return isset($item['method']) && $item['method'] === 'delete';
});
?>

<?php if (!empty($view)) { ?>
    <a href="<?php echo $this->Url->build('/' . $controller . '/view/' . $id) ?>"
       title="View">
                                                    <span style="color:#3c8dbc;padding-left:5px;font-size:18px;">
                                                        <i class="fa fa-eye" aria-hidden="true"></i>
                                                    </span>
    </a>
<?php } ?>

<?php if (!empty($edit)) { ?>
    <a href="<?php echo $this->Url->build('/' . $controller . '/edit/' . $id) ?>"
       title="Edit">
                                                    <span style="color:#00a65a;padding-left:5px;font-size:18px;">
                                                        <i class="fa fa-pencil" aria-hidden="true"></i>
                                                    </span>
    </a>
<?php } ?>

<?php if (!empty($delete)) { ?>
    <a   href="<?php echo $this->Url->build('/' . $controller . '/delete/' . $id) ?>" onclick="return confirm('Are you sure you want to delete?');"  title="Remove">
                                                    <span style="color:#8B0000;padding-left:5px;font-size:18px;">
                                                        <i class="fa fa-remove" aria-hidden="true"></i>
                                                    </span>
    </a>
<?php } ?>


