| @@ 8-43 (lines=36) @@ | ||
| 5 | use Ultraware\Roles\Traits\PermissionHasRelations; |
|
| 6 | use Ultraware\Roles\Traits\Slugable; |
|
| 7 | ||
| 8 | class Permission extends Model implements PermissionHasRelationsContract |
|
| 9 | { |
|
| 10 | use Slugable, PermissionHasRelations; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * The attributes that are mass assignable. |
|
| 14 | * |
|
| 15 | * @var array |
|
| 16 | */ |
|
| 17 | protected $fillable = [ |
|
| 18 | 'name', |
|
| 19 | 'slug', |
|
| 20 | 'description', |
|
| 21 | 'model' |
|
| 22 | ]; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * The "booting" method of the model. |
|
| 26 | * |
|
| 27 | * @return void |
|
| 28 | */ |
|
| 29 | protected static function boot() |
|
| 30 | { |
|
| 31 | parent::boot(); |
|
| 32 | ||
| 33 | // Generated the slug before updating. |
|
| 34 | static::updating(function ($model) { |
|
| 35 | $model->setSlugAttribute($model->name); |
|
| 36 | }); |
|
| 37 | ||
| 38 | // Generated the slug before creating. |
|
| 39 | static::creating(function ($model) { |
|
| 40 | $model->setSlugAttribute($model->name); |
|
| 41 | }); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||
| @@ 8-44 (lines=37) @@ | ||
| 5 | use Ultraware\Roles\Traits\RoleHasRelations; |
|
| 6 | use Ultraware\Roles\Traits\Slugable; |
|
| 7 | ||
| 8 | class Role extends Model implements RoleHasRelationsContract |
|
| 9 | { |
|
| 10 | use Slugable, RoleHasRelations; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * The attributes that are mass assignable. |
|
| 14 | * |
|
| 15 | * @var array |
|
| 16 | */ |
|
| 17 | protected $fillable = [ |
|
| 18 | 'name', |
|
| 19 | 'slug', |
|
| 20 | 'description', |
|
| 21 | 'css', |
|
| 22 | 'level' |
|
| 23 | ]; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * The "booting" method of the model. |
|
| 27 | * |
|
| 28 | * @return void |
|
| 29 | */ |
|
| 30 | protected static function boot() |
|
| 31 | { |
|
| 32 | parent::boot(); |
|
| 33 | ||
| 34 | // Generated the slug before updating. |
|
| 35 | static::updating(function ($model) { |
|
| 36 | $model->setSlugAttribute($model->name); |
|
| 37 | }); |
|
| 38 | ||
| 39 | // Generated the slug before creating. |
|
| 40 | static::creating(function ($model) { |
|
| 41 | $model->setSlugAttribute($model->name); |
|
| 42 | }); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||