<commit_before><?php

namespace LaravelFlare\Flare\Admin\Models\Users;

use App\Models\User;
use App\Models\UserGroup;
use LaravelFlare\Flare\Admin\Models\ManagedModel;
use LaravelFlare\Flare\Traits\ManagedModel\HumanTimestampAttributes;

class ManagedUser extends ManagedModel
{
    use HumanTimestampAttributes;

    /**
     * Managed Model Instance.
     * 
     * @var string
     */
    public $managedModel = \App\User::class;

    /**
     * ManagedModel Icon.
     *
     * Font Awesome Defined Icon, eg 'user' = 'fa-user'
     *
     * @var string
     */
    public static $icon = '';

    /**
     * Map User Attributes to their Attribute Types.
     * 
     * @var array
     */
    protected $mapping = [
        'name' => ['type' => 'text', 'length' => 32, 'required' => 'required'],
        'email' => ['type' => 'email', 'length' => 255, 'required' => 'required'],
        'password' => ['type' => 'password', 'length' => 32, 'required' => 'required'],
        'usergroup' => ['type' => 'radio', 'required' => 'required'],
    ];

    /**
     * Validation Rules for onCreate, onEdit actions.
     * 
     * @var array
     */
    protected $rules = [
        'name' => 'required|max:32',
        'email' => 'required|email',
        'password' => '<PASSWORD>',
    ];

    /**
     * Summary Fields for Model.
     *
     * Defines which fields to show in the listing tables output.
     * 
     * @var array
     */
    protected $summary_fields = [
        'id' => 'ID',
        'name',
        'email',
        'usergroup.name' => 'Group',
        'created_at' => 'Created',
        'updated_at' => 'Updated',
    ];

    /**
     * The number of models to return for pagination.
     *
     * If int greater than 0 then pagination is used, otherwise
     * all entries will be output.
     *
     * @var int
     */
    protected $perPage = 10;

    /**
     * When a new password is set, hash it.
     * 
     * @param string
     */
    protected function setPasswordAttribute($value)
    {
        if ($value == '') {
            return;
        }

        $this->model->setAttribute('password', bcrypt($value));
    }

    /**
     * Don't output passwords.
     * 
     * @param string
     */
    protected function getPasswordAttribute()
    {
        return;
    }

    /**
     * Don't output passwords.
     * 
     * @param string
     */
    protected function getUsergroupAttribute($model)
    {
        return $model->userGroup->name; // I dont like having to do this, I'd prefer some sweet dot notation.
    }

    /**
     * Returns the available options for the Group Option.
     * 
     * @return array
     */
    public function getUsergroupOptions()
    {
        return \App\Models\UserGroup::lists('name', 'id')->toArray();
    }
}
<commit_msg>ManagedUser minor amend<commit_after><?php

namespace LaravelFlare\Flare\Admin\Models\Users;

use App\Models\User;
use App\Models\UserGroup;
use LaravelFlare\Flare\Admin\Models\ManagedModel;
use LaravelFlare\Flare\Traits\ManagedModel\HumanTimestampAttributes;

class ManagedUser extends ManagedModel
{
    use HumanTimestampAttributes;

    /**
     * Managed Model Instance.
     * 
     * @var string
     */
    public $managedModel = \App\User::class;

    /**
     * ManagedModel Icon.
     *
     * Font Awesome Defined Icon, eg 'user' = 'fa-user'
     *
     * @var string
     */
    public static $icon = 'fa-user';

    /**
     * Map User Attributes to their Attribute Types.
     * 
     * @var array
     */
    protected $mapping = [
        'name' => ['type' => 'text', 'length' => 32, 'required' => 'required'],
        'email' => ['type' => 'email', 'length' => 255, 'required' => 'required'],
        'password' => ['type' => 'password', 'length' => 32, 'required' => 'required'],
    ];

    /**
     * Validation Rules for onCreate, onEdit actions.
     * 
     * @var array
     */
    protected $rules = [
        'name' => 'required|max:32',
        'email' => 'required|email',
        'password' => '<PASSWORD>',
    ];

    /**
     * Summary Fields for Model.
     *
     * Defines which fields to show in the listing tables output.
     * 
     * @var array
     */
    protected $summary_fields = [
        'id' => 'ID',
        'name',
        'email',
        'created_at' => 'Created',
        'updated_at' => 'Updated',
    ];

    /**
     * The number of models to return for pagination.
     *
     * If int greater than 0 then pagination is used, otherwise
     * all entries will be output.
     *
     * @var int
     */
    protected $perPage = 10;

    /**
     * When a new password is set, hash it.
     * 
     * @param string
     */
    protected function setPasswordAttribute($value)
    {
        if ($value == '') {
            return;
        }

        $this->model->setAttribute('password', <PASSWORD>($value));
    }

    /**
     * Don't output passwords.
     * 
     * @param string
     */
    protected function getPasswordAttribute()
    {
        return;
    }
}

{'fraction_non_alphanumeric': 0.14582086574905245, 'fraction_numerical': 0.0047875523638539795, 'mean_word_length': 1.9792038027332144, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 53, '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': '7381930', 'n_tokens_mistral': 1554, 'n_tokens_neox': 1487, 'n_words': 385}