{"id":25928118,"url":"https://github.com/appzcoder/laravel-roles","last_synced_at":"2025-03-03T21:11:46.083Z","repository":{"id":34665812,"uuid":"38637781","full_name":"appzcoder/laravel-roles","owner":"appzcoder","description":"This package is DEPRECATED in favour of laravel-admin","archived":false,"fork":false,"pushed_at":"2015-08-24T13:15:59.000Z","size":151,"stargazers_count":6,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-03-25T21:35:07.103Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/appzcoder/laravel-roles","language":"PHP","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/appzcoder.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":"2015-07-06T18:24:48.000Z","updated_at":"2024-01-18T02:34:23.000Z","dependencies_parsed_at":"2022-08-28T13:00:58.788Z","dependency_job_id":null,"html_url":"https://github.com/appzcoder/laravel-roles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appzcoder%2Flaravel-roles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appzcoder%2Flaravel-roles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appzcoder%2Flaravel-roles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appzcoder%2Flaravel-roles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appzcoder","download_url":"https://codeload.github.com/appzcoder/laravel-roles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241739551,"owners_count":20012105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-03-03T21:11:45.469Z","updated_at":"2025-03-03T21:11:46.075Z","avatar_url":"https://github.com/appzcoder.png","language":"PHP","readme":"# Laravel Roles\nLaravel 5 User Role Manager\n\nThe idea of this package came from laracast [laracasts/Users-and-Roles-in-Laravel](https://github.com/laracasts/Users-and-Roles-in-Laravel) and now it is built for laravel 5.\n\n### Requirements\n    Laravel \u003e=5.1\n    PHP \u003e= 5.5.9 \n    \n## Installation\n\n1. Run \n    ```\n    composer require \"appzcoder/laravel-roles\":\"dev-master\"\n    ```\n    \n2. Add service provider into **/config/app.php** file.\n    ```php\n    'providers' =\u003e [\n        ...\n    \n        Appzcoder\\LaravelRoles\\LaravelRolesServiceProvider::class,\n    ],\n    ```\n\n4. Publish migrations\n    ```\n    php artisan vendor:publish\n    ```\n\n4. Run migrate command\n    ```\n    php artisan migrate\n    ```\n    \n5. Include **UserRoles** trait to your **user model** located at **/app/User.php**\n    ```php\n    use Appzcoder\\LaravelRoles\\Traits\\UserRoles;\n    \n    class User extends Model implements AuthenticatableContract, CanResetPasswordContract\n    {\n        use Authenticatable, CanResetPassword, UserRoles;\n    ```\n\n## Usage\n\nUse the routes as bellow.\n\n```php\nRoute::get('/roles', function () {\n\n    /* Create user if needed\n    App\\User::create([\n    'name' =\u003e 'Sohel Amin',\n    'email' =\u003e 'sohelamincse@gmail.com',\n    'password' =\u003e bcrypt('123456'),\n    ]);\n     */\n\n    $user = App\\User::first();\n\n    /* Create roles\n    $role = new Appzcoder\\LaravelRoles\\Models\\Role;\n    $role-\u003ename = 'admin';\n    $role-\u003esave();\n     */\n\n    /* Assign and remove role from user\n    $role = Appzcoder\\LaravelRoles\\Models\\Role::whereName('admin')-\u003efirst();\n    $user-\u003eassignRole($role);\n    //$user-\u003eremoveRole(2);\n     */\n\n    return $user-\u003eroles;\n});\n\nRoute::get('/admin', ['middleware' =\u003e 'role:admin', 'uses' =\u003e 'AdminController@index']);\n```\n\n##Author\n\n\u003ca href=\"http://www.sohelamin.com\"\u003eSohel Amin\u003c/a\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappzcoder%2Flaravel-roles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappzcoder%2Flaravel-roles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappzcoder%2Flaravel-roles/lists"}