<commit_before># Groupable
Groupable is a Laravel package for grouping content.

It takes its inspiration from the Drupal community - think of it as a simplified Organic Groups for Laravel.

## Introduction
The idea of Groupable is to turn any Eloquent model into a group which can be 'joined' by users and act as a container for 'content'.

Addtionally, users may be given group roles on a role-by-role, group-by-group, basis.

Groupable works by adding traits to the models within your application that you wish to have this group like behaviour.

### The Traits
Groupable provides three traits which can be added to your models:

- The `CanJoinGroups` trait is added to your User model.
- The `IsGroup` trait is added to a model which you would like to be treated as a group.
- The `IsGroupable` trait is added to models which you would like to be treated as group content.

### Helper methods
Groupable includes a class called `Groupable` which offers some simple helper methods.

### Database Structure
Groupable requires 3 tables to be added to your schema and includes database migrations out of the box.

There is no need to publish these migrations to your project as the accompanying service provider points to the migrations folder within your Composer vendor folder.

## Installation
Installation is via composer:

```
composer require etsh\groupable
```

Then be sure to include the `GroupableServiceProvider` in you a `app` config file:

```
Etsh\Groupable\GroupableServiceProvider::class
```

Finally, run the migrations:

```
art migrate
```

## Instructions

### Creating a Group
Simply `use` the `Is group` trait in the model that you wish to become a group.

Then create the properties `$groupable_models` and `$groupable_roles`.

`$groupable_models` should be an array containing the fully-qualified class name of the models which should be allowed to be grouped within this group.

`$groupable_roles` should be an array contining the names of additional roles that you wish members to be grantable to members of this group.

```
use Etsh\Groupable\Traits\IsGroup;

class Group extends Model
{
    use IsGroup

    protected $groupable_models = [
        Department::class,
    ];

    protected $groupable_roles = [
        'admin',
    ];
}
```
<commit_msg>Documentation.<commit_after># Groupable
Groupable is a Laravel package for grouping content.

It takes its inspiration from the Drupal community - think of it as a simplified Organic Groups for Laravel.

## Introduction
The idea of Groupable is to turn any Eloquent model into a group which can be 'joined' by users and act as a container for 'content'.

Addtionally, users may be given group roles on a role-by-role, group-by-group, basis.

Groupable works by adding traits to the models within your application that you wish to have this group like behaviour.

### The Traits
Groupable provides three traits which can be added to your models:

- The `CanJoinGroups` trait is added to your User model.
- The `IsGroup` trait is added to a model which you would like to be treated as a group.
- The `IsGroupable` trait is added to models which you would like to be treated as group content.

### Helper methods
Groupable includes a class called `Groupable` which offers some simple helper methods.

### Database Structure
Groupable requires 3 tables to be added to your schema and includes database migrations out of the box.

There is no need to publish these migrations to your project as the accompanying service provider points to the migrations folder within your Composer vendor folder.

## Installation
Installation is via composer:

```
composer require etsh\groupable
```

Then be sure to include the `GroupableServiceProvider` in you a `app` config file:

```
Etsh\Groupable\GroupableServiceProvider::class
```

Finally, run the migrations:

```
art migrate
```

## Instructions

### Creating a Group
Simply `use` the `IsGroup` trait in the model that you wish to become a group.

```
use Etsh\Groupable\Traits\IsGroup;

class Group extends Model
{
    use IsGroup
```

Then create the properties `$groupable_models` and `$groupable_roles`.

`$groupable_models` should be an array containing the fully-qualified class name of the models which should be allowed to be grouped within this group.

`$groupable_roles` should be an array contining the names of additional roles that you wish members to be grantable to members of this group.

```
    protected $groupable_models = [
        GroupableContent::class,
    ];

    protected $groupable_roles = [
        'admin',
    ];

    ...
}
```

{'fraction_non_alphanumeric': 0.06199519755511897, 'fraction_numerical': 0.0004365858982754857, 'mean_word_length': 4.183257918552036, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5637207', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1187, 'n_words': 637}