Pages Permission
If you want to control the user's permissions in the page, you can refer to the following example:
Contoh 1
For example, there is now a scene, here is a article module, we use create articles as an example
At first open http://localhost/settings/permissions, fill up slug field with text create-post, and Create post in name field, then assign this permission to some roles.
In your controller action:
use Novay\Nue\Nue\Permission;
class PostController extends Controller
{
public function create()
{
// check permission, only the roles with permission `create-post` can visit this action
Permission::check('create-post');
}
}
Contoh 2
// Roles dengan permission tertentu tidak diizin untuk menghapus data.
if (!Admin::user()->can('delete-image')) {
notify('Kamu tidak memiliki izin.', 'error');
return redirect()->back();
}
// Hanya roles dengan permission `view-title-column` yang bisa menampilkan teks ini
if (Admin::user()->can('view-title-column')) {
return 'Title';
}