improved permission attachment

This commit is contained in:
denisdulici
2020-04-03 13:50:49 +03:00
parent babffc06f2
commit 04f2872e62
3 changed files with 41 additions and 16 deletions

View File

@ -11,7 +11,6 @@ use Modules\OfflinePayments\Http\Requests\SettingDelete as DRequest;
class Settings extends Controller
{
/**
* Show the form for editing the specified resource.
*
@ -157,7 +156,7 @@ class Settings extends Controller
$message = trans('messages.success.deleted', ['type' => $remove['name']]);
// because it show nofitication.
// because it show notification.
//flash($message)->success();
return response()->json([

View File

@ -9,6 +9,8 @@ class InstallModule
{
use Permissions;
public $alias = 'offline-payments';
/**
* Handle the event.
*
@ -17,7 +19,7 @@ class InstallModule
*/
public function handle(Event $event)
{
if ($event->alias != 'offline-payments') {
if ($event->alias != $this->alias) {
return;
}
@ -26,10 +28,9 @@ class InstallModule
protected function updatePermissions()
{
// c=create, r=read, u=update, d=delete
$this->attachPermissionsToAdminRoles([
$this->createModuleSettingPermission('offline-payments', 'read'),
$this->createModuleSettingPermission('offline-payments', 'update'),
$this->createModuleSettingPermission('offline-payments', 'delete'),
$this->alias . '-settings' => 'r,u,d',
]);
}
}