{"id":36989052,"url":"https://github.com/antonyagustine/roles-and-permission","last_synced_at":"2026-01-13T23:28:19.718Z","repository":{"id":57044816,"uuid":"136276926","full_name":"antonyagustine/roles-and-permission","owner":"antonyagustine","description":"laravel simple roles and permission","archived":false,"fork":false,"pushed_at":"2022-03-29T03:28:58.000Z","size":561,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T16:25:03.724Z","etag":null,"topics":["laravel","laravel-package","permissions","php","rap","roles"],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonyagustine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-06T05:34:45.000Z","updated_at":"2023-01-22T05:42:24.000Z","dependencies_parsed_at":"2022-08-24T03:40:13.824Z","dependency_job_id":null,"html_url":"https://github.com/antonyagustine/roles-and-permission","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/antonyagustine/roles-and-permission","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyagustine%2Froles-and-permission","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyagustine%2Froles-and-permission/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyagustine%2Froles-and-permission/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyagustine%2Froles-and-permission/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonyagustine","download_url":"https://codeload.github.com/antonyagustine/roles-and-permission/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonyagustine%2Froles-and-permission/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28404682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-package","permissions","php","rap","roles"],"created_at":"2026-01-13T23:28:19.204Z","updated_at":"2026-01-13T23:28:19.706Z","avatar_url":"https://github.com/antonyagustine.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003c!-- \u003cimg src=\"https://raw.githubusercontent.com/antony382/roles-and-permission/master/public/images/logo.png\" style=\"width: 15% !important;max-width: 20% !important;\"\u003e--\u003e\n\u003c/p\u003e\n\n![Latest Stable Version](https://poser.pugx.org/laravel/laravel/v/stable) [![Latest Unstable Version](https://poser.pugx.org/laravel/laravel/v/unstable)](https://packagist.org/packages/laravel/laravel) [![License](https://poser.pugx.org/laravel/laravel/license)](https://packagist.org/packages/laravel/laravel)\n\n\n# Roles And Permission (RAP)\n\nA simple package to assign RAP(Roles And Permission) for an application.\n\n## Installation\n\nVia composer\n```\ncomposer require \"processdrive/rap\":\"dev-master\"\n```\nOr set in composer.json\n```\n\"require\": {\n    \"processdrive/rap\":\"dev-master\"\n}\n```\n\n## Register Dependencies\n\nSet configuration in `config/app.php`\n\n```    \n// Set providers.\n'providers' =\u003e [\n    Collective\\Html\\HtmlServiceProvider::class,\n    processdrive\\rap\\RAPServiceProvider::class,\n]\n\n// Set aliases\n'aliases' =\u003e [\n    'Form' =\u003e 'Collective\\Html\\FormFacade',\n    'Html' =\u003e 'Collective\\Html\\HtmlFacade',\n    'RAPHelper' =\u003e processdrive\\rap\\app\\Helpers\\RAPHelper::class,\n],\n```\n\nSet relationship in `app/User.php`\n\n```\n/**\n * @return @return \\Illuminate\\Database\\Eloquent\\Relations\\belongsToMany\n */\npublic function roles() {\n    return $this-\u003ebelongsToMany(\"App\\Models\\Role\",\"user_role\", \"user_id\", \"role_id\");\n}\n\n/**\n * [hasPermission]\n * @param  [str]  $permission\n * @return boolean\n */\npublic function hasPermission($permission) {\n    return $this-\u003eroles()-\u003eget()[0]-\u003ehasPermission($permission);\n}\n```\n\n## Publish the package\n\n```\nphp artisan vendor:publish --all\n```\n\n## Configuration\n\nSet configuration in `config/rap/rap_config.php`\n\n```\nreturn [\n    \n    // Set Route access enable or disable\n    'use_package_routes' =\u003e true,\n\n    // Set middlewares\n    'middlewares' =\u003e ['auth', 'CheckRole'],\n\n    // Set Static Action\n    'static_action' =\u003e [\n        'index' =\u003e 'List', \n        'create' =\u003e 'Create', \n        'show' =\u003e 'Show', \n        'edit' =\u003e 'Edit', \n        'destroy' =\u003e 'Destroy', \n        'store' =\u003e 'Store', \n        'update' =\u003e 'Update', \n        'delete' =\u003e 'Delete'\n    ],\n\n    //Set Omit Action it will be womited from permission module.\n    'omit_action' =\u003e []\n];\n```\n\n\n\n## Run command\n\n``` \ncomposer dump-autoload\n```\n\n## Run migration\n\n```\nphp artisan migrate\n```\n\n## Generate translation and DB seed\n\n```\nphp artisan rap_generate:translation\n```\n\n## Edit translation files\n```\nresources/lang/en/rap_actions.php\nresources/lang/en/rap_modules.php\n```\n\n## Add Route\n\nAdd Route in `routes/web.php`\n    \n```\nRoute::group(['middleware' =\u003e 'CheckRole'], function () {\n    //add routes which are going to validate by RAP.\n});\n\nRAPHelper::routes();\n```\n\n## Add ifream in your application\n\nAdd ifream in your application\n\n```\n\u003ciframe src=\"{{ route('rap', 'roles.index') }}\" width=\"100%\" height=\"100%\" style=\" border: 0;\"\u003e\u003c/iframe\u003e\n```\n\n## Register Middelware\n\nregister in your `app/Http/kernel.php`\n\n```\nprotected $routeMiddleware = [\n    'CheckRole' =\u003e processdrive\\rap\\app\\Http\\Middleware\\CheckRole::class,\n];     \n```\n## Usage\n\n```\n@hasPermission(\"viewSettings\")\n    // your code\n@endHasPermission\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonyagustine%2Froles-and-permission","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonyagustine%2Froles-and-permission","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonyagustine%2Froles-and-permission/lists"}