removed prefix from permission title
This commit is contained in:
@@ -13,6 +13,13 @@ class Permission extends LaratrustPermission
|
||||
|
||||
protected $table = 'permissions';
|
||||
|
||||
/**
|
||||
* The accessors to append to the model's array form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $appends = ['title'];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
@@ -37,4 +44,24 @@ class Permission extends LaratrustPermission
|
||||
|
||||
return $query->usingSearchString($search)->sortable($sort)->paginate($limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name including rate.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitleAttribute()
|
||||
{
|
||||
$replaces = [
|
||||
'Create ' => '',
|
||||
'Read ' => '',
|
||||
'Update ' => '',
|
||||
'Delete ' => '',
|
||||
'Modules' => 'Apps',
|
||||
];
|
||||
|
||||
$title = str_replace(array_keys($replaces), array_values($replaces), $this->display_name);
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user