<commit_before><?php namespace Orchestra\Model;

use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Support\Facades\Config;
use Orchestra\Acl;

class Role extends Eloquent {

	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'roles';

	/**
	 * The attributes that are mass assignable.
	 *
	 * @var array
	 */
	protected $fillable = array(
		'name',
	);

	/**
	 * Indicates if the model should soft delete.
	 *
	 * @var bool
	 */
	protected $softDelete = true;

	/**
	 * Has many and belongs to relationship with User.
	 *
	 * @access public
	 * @return Illuminate\Database\Eloquent\Relations\BelongsToMany
	 */
	public function users() 
	{
		return $this->belongsToMany('\Orchestra\Model\User', 'user_role');
	}

	/**
	 * The "booting" method of the model.
	 *
	 * @return void
	 */
	protected static function boot()
	{
		parent::boot();

		static::creating(function ($role)
		{
			Acl::addRole($role->getAttribute('name'));
		});

		static::updating(function ($role)
		{
			$originalName = $role->getOriginal('name');
			$currentName  = $role->getAttribute('name');
			$deletedAt    = $role->getDeletedAtColumn();

			if ($role->isSoftDeleting() 
				and is_null($role->getAttribute($deletedAt) 
				and ! is_null($role->getOriginal($deletedAt))
			{
				Acl::addRole($currentName);
			}
			else 
			{
				Acl::renameRole($originalName, $currentName);
			}
		});

		static::deleting(function ($role)
		{
			Acl::removeRole($role->getAttribute('name'));
		});
	}

	/**
	 * Get default roles for Orchestra Platform
	 *
	 * @static
	 * @access public
	 * @return self
	 */
	public static function admin()
	{
		return static::find(
			Config::get('orchestra/auth::role.admin')
		);
	}

	/**
	 * Get default member roles for Orchestra Platform
	 *
	 * @static
	 * @access public
	 * @return self
	 */
	public static function member()
	{
		return static::find(
			Config::get('orchestra/auth::role.member')
		);
	}
}
<commit_msg>Fixed invalid closing.<commit_after><?php namespace Orchestra\Model;

use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Support\Facades\Config;
use Orchestra\Acl;

class Role extends Eloquent {

	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'roles';

	/**
	 * The attributes that are mass assignable.
	 *
	 * @var array
	 */
	protected $fillable = array(
		'name',
	);

	/**
	 * Indicates if the model should soft delete.
	 *
	 * @var bool
	 */
	protected $softDelete = true;

	/**
	 * Has many and belongs to relationship with User.
	 *
	 * @access public
	 * @return Illuminate\Database\Eloquent\Relations\BelongsToMany
	 */
	public function users() 
	{
		return $this->belongsToMany('\Orchestra\Model\User', 'user_role');
	}

	/**
	 * The "booting" method of the model.
	 *
	 * @return void
	 */
	protected static function boot()
	{
		parent::boot();

		static::creating(function ($role)
		{
			Acl::addRole($role->getAttribute('name'));
		});

		static::updating(function ($role)
		{
			$originalName = $role->getOriginal('name');
			$currentName  = $role->getAttribute('name');
			$deletedAt    = $role->getDeletedAtColumn();

			if ($role->isSoftDeleting() 
				and is_null($role->getAttribute($deletedAt)) 
				and ! is_null($role->getOriginal($deletedAt)))
			{
				Acl::addRole($currentName);
			}
			else 
			{
				Acl::renameRole($originalName, $currentName);
			}
		});

		static::deleting(function ($role)
		{
			Acl::removeRole($role->getAttribute('name'));
		});
	}

	/**
	 * Get default roles for Orchestra Platform
	 *
	 * @static
	 * @access public
	 * @return self
	 */
	public static function admin()
	{
		return static::find(
			Config::get('orchestra/auth::role.admin')
		);
	}

	/**
	 * Get default member roles for Orchestra Platform
	 *
	 * @static
	 * @access public
	 * @return self
	 */
	public static function member()
	{
		return static::find(
			Config::get('orchestra/auth::role.member')
		);
	}
}

{'fraction_non_alphanumeric': 0.15471698113207547, 'fraction_numerical': 0.0, 'mean_word_length': 3.3311546840958606, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '4077554', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1300, 'n_words': 288}