12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App\Repositories\Models\Base;
- use Prettus\Repository\Contracts\Transformable;
- use Prettus\Repository\Traits\TransformableTrait;
- use Spatie\Permission\Traits\HasPermissions;
- /**
- * Class Role.
- *
- * @package namespace App\Repositories\Models\Base;
- */
- class Role extends \Spatie\Permission\Models\Role implements Transformable
- {
- use TransformableTrait;
- protected $table = 'base_roles';
- /**
- * The attributes that are mass assignable.
- *
- * @var array
- */
- protected $guarded = [];
- // protected static function booted()
- // {
- // self::language();
- // }
- public function setMenusAttribute($val)
- {
- if (count($val) == 0) return '';
- $this->attributes['menus'] = '-' . arr2str($val, '-') . '-';
- }
- public function getMenusAttribute($val)
- {
- return str2arr(trim($val, '-'), '-');
- }
- public function setParentMenusAttribute($val)
- {
- if (count($val) == 0) return '';
- $this->attributes['parent_menus'] = '-' . arr2str($val, '-') . '-';
- }
- public function getParentMenusAttribute($val)
- {
- return str2arr(trim($val, '-'), '-');
- }
- }
|