<commit_before># Roles for Laravel 5 / 6
Powerful package for handling roles in Laravel

[![Build Status](https://travis-ci.org/httpoz/roles.svg)](https://travis-ci.org/httpoz/roles)
[![Total Downloads](https://poser.pugx.org/httpoz/roles/d/total.svg)](https://packagist.org/packages/httpoz/roles)
[![codecov](https://codecov.io/gh/httpoz/roles/branch/master/graph/badge.svg)](https://codecov.io/gh/httpoz/roles)
[![Latest Stable Version](https://poser.pugx.org/httpoz/roles/v/stable.svg)](https://packagist.org/packages/httpoz/roles)

#### Previous Versions
For Previous versions please see the [releases page](https://github.com/httpoz/roles/releases)

- [Installation](#installation)
    - [Composer](#composer)
    - [Config File And Migrations](#config-file-and-migrations)
    - [HasRoleAndPermission Trait And Contract](#hasroleandpermission-trait-and-contract)
- [Usage](#usage)
    - [Creating Roles](#creating-roles)
    - [Attaching And Detaching Roles](#attaching-and-detaching-roles)
    - [Syncing Roles](#syncing-roles)
    - [Checking For Roles](#checking-for-roles)
    - [Find users by role](#find-users-by-role)
    - [Groups](#groups)
    - [Blade Extensions](#blade-extensions)
    - [Middleware](#middleware)
    - [Caching](#caching)
- [Config File](#config-file)
- [License](#license)

## Installation
This package is very easy to set up. There are only couple of steps.

### Composer
Add the package to your project via composer.
```bash
composer require httpoz/roles:^v8.0
```

### Config File And Migrations
To publish the package config's file and migrations to your application. Run this command inside your terminal.
```bash
php artisan vendor:publish --provider="HttpOz\Roles\RolesServiceProvider"
php artisan migrate
```

### Enable HasRole Trait And Contract
Include `HasRole` trait and also implement `HasRole` contract inside your User model.
```php
<?php

use HttpOz\Roles\Traits\HasRole;<commit_msg>:broom:<commit_after># Roles for Laravel
Simple package for handling roles in Laravel.

[![Build Status](https://travis-ci.org/httpoz/roles.svg)](https://travis-ci.org/httpoz/roles)
[![Total Downloads](https://poser.pugx.org/httpoz/roles/d/total.svg)](https://packagist.org/packages/httpoz/roles)
[![codecov](https://codecov.io/gh/httpoz/roles/branch/master/graph/badge.svg)](https://codecov.io/gh/httpoz/roles)
[![Latest Stable Version](https://poser.pugx.org/httpoz/roles/v/stable.svg)](https://packagist.org/packages/httpoz/roles)

## Installation
This package is very easy to set up. There are only couple of steps.

### Previous Versions

For Previous versions please see the [releases page](https://github.com/httpoz/roles/releases)

### Composer
Add the package to your project via composer.
```bash
composer require httpoz/roles:^v8.0
```

### Config File And Migrations
To publish the package config's file and migrations to your application. Run this command inside your terminal.
```bash
php artisan vendor:publish --provider="HttpOz\Roles\RolesServiceProvider"
php artisan migrate
```

### Enable HasRole Trait And Contract
Include `HasRole` trait and also implement `HasRole` contract inside your User model.
```php
<?php

use HttpOz\Roles\Traits\HasRole;
{'fraction_non_alphanumeric': 0.14762796504369538, 'fraction_numerical': 0.0018726591760299626, 'mean_word_length': 4.913284132841328, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1935236', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1033, 'n_words': 249}