| Total Complexity | 3 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 9 | class Ability extends Model |
||
| 10 | { |
||
| 11 | use UuidAsPrimaryKey; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Set the incrementing property to false. |
||
| 15 | * |
||
| 16 | * @var bool |
||
| 17 | */ |
||
| 18 | public $incrementing = false; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * The primary key column type. |
||
| 22 | * |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | protected $keyType = 'string'; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * The fields which are protected against mass assignment. |
||
| 29 | * |
||
| 30 | * @var array |
||
| 31 | */ |
||
| 32 | protected $guarded = ['id']; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Set the slug value from the name attribute. |
||
| 36 | * |
||
| 37 | * @param string $value |
||
| 38 | * @return void |
||
| 39 | */ |
||
| 40 | public function setNameAttribute($value) |
||
| 41 | { |
||
| 42 | $this->attributes['slug'] = Str::slug($value, '-'); |
||
| 43 | $this->attributes['name'] = $value; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Path to the ability. |
||
| 48 | * |
||
| 49 | * @return string |
||
| 50 | */ |
||
| 51 | public function path() |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Get all Roles associated with the Ability. |
||
| 58 | * |
||
| 59 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
| 60 | */ |
||
| 61 | public function roles() |
||
| 66 |