PHP code example of gopex / laratrust-permission-creator
1. Go to this page and download the library: Download gopex/laratrust-permission-creator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gopex / laratrust-permission-creator example snippets
"permissions" => [
// 1. Simple Format (No extra details needed)
"edit_posts",
// 2. Advanced Format (With custom display name and description)
"delete_users" => [
"display_name" => "Delete Registered Users", // Optional
"description" => "Allows a user to permanently delete accounts" // Optional
]
],
"roles" => [
// 1. Simple Format
"moderator",
// 2. Advanced Format
"super_admin" => [
"display_name" => "Super Administrator", // Optional
"description" => "Has full control over the entire system" // Optional
]
],
"rolesPermissions" => [
// Bind existing permissions to an existing role
"super_admin" => [
"edit_posts",
"delete_users",
],
// Smart Behavior Example:
"support_agent" => [
"edit_posts",
"view_logs" // This permission will be auto-created even if missing in the 'permissions' array!
]
]