Skip to content

Commit 441fc9c

Browse files
update
1 parent 012405c commit 441fc9c

File tree

6 files changed

+16
-0
lines changed

6 files changed

+16
-0
lines changed

resources/views/components/cms/devices/⚡create-update/create-update.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ public function resetRecordData()
111111
// Handle form submit
112112
public function submit(StoreDeviceAction $storeAction, UpdateDeviceAction $updateAction)
113113
{
114+
Gate::authorize(($this->isUpdate ? 'update' : 'create').$this->modelInstance);
115+
114116
$this->validate([
115117
'name' => 'required|string|max:255',
116118
'ai_enabled' => 'required|boolean',
@@ -143,6 +145,8 @@ public function submit(StoreDeviceAction $storeAction, UpdateDeviceAction $updat
143145

144146
public function saveWebhooks(SyncDeviceWebhooksAction $syncWebhooksAction)
145147
{
148+
Gate::authorize(($this->isUpdate ? 'update' : 'create').$this->modelInstance);
149+
146150
$syncWebhooksAction->handle(
147151
device: Device::findOrFail($this->id),
148152
webhooks: $this->webhook,
@@ -163,6 +167,8 @@ public function saveWebhooks(SyncDeviceWebhooksAction $syncWebhooksAction)
163167

164168
public function saveProxy(ConfigureDeviceProxy $saveProxyAction)
165169
{
170+
Gate::authorize(($this->isUpdate ? 'update' : 'create').$this->modelInstance);
171+
166172
try {
167173
$saveProxyAction->handle(
168174
device: Device::findOrFail($this->id),

resources/views/components/cms/management/menu/sub/⚡create-update/create-update.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ public function resetRecordData()
110110
// Handle form submit
111111
public function submit(StoreMenuSubAction $storeAction, UpdateMenuSubAction $updateAction)
112112
{
113+
Gate::authorize(($this->isUpdate ? 'update' : 'create').$this->modelInstance);
114+
113115
$this->validate([
114116
'role_id' => 'required|exists:roles,id',
115117
'menu_id' => 'required|exists:menus,id',

resources/views/components/cms/management/menu/⚡create-update/create-update.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ public function resetRecordData()
101101
// Handle form submit
102102
public function submit(StoreMenuAction $storeAction, UpdateMenuAction $updateAction)
103103
{
104+
Gate::authorize(($this->isUpdate ? 'update' : 'create').$this->modelInstance);
105+
104106
$this->validate([
105107
'role_id' => 'required|exists:roles,id',
106108
'name' => 'required|string|max:255',

resources/views/components/cms/management/permission/⚡create-update/create-update.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ public function resetRecordData()
6464
// Handle form submit
6565
public function submit(StorePermissionAction $storeAction, UpdatePermissionAction $updateAction)
6666
{
67+
Gate::authorize(($this->isUpdate ? 'update' : 'create').$this->modelInstance);
68+
6769
$this->validate([
6870
'name' => 'required|string|max:255',
6971
'guard_name' => 'required|string|max:255',

resources/views/components/cms/management/role/⚡create-update/create-update.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ public function resetRecordData()
6464
// Handle form submit
6565
public function submit(StoreRoleAction $storeAction, UpdateRoleAction $updateAction)
6666
{
67+
Gate::authorize(($this->isUpdate ? 'update' : 'create').$this->modelInstance);
68+
6769
$this->validate([
6870
'name' => 'required|string|max:255',
6971
'guard_name' => 'required|string|max:255',

resources/views/components/cms/management/user/⚡create-update/create-update.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ public function resetRecordData()
7979
// Handle form submit
8080
public function submit(StoreUserAction $storeAction, UpdateUserAction $updateAction)
8181
{
82+
Gate::authorize(($this->isUpdate ? 'update' : 'create').$this->modelInstance);
83+
8284
$this->validate([
8385
'role' => 'required|string|exists:roles,name',
8486
'name' => 'required|string|max:255',

0 commit comments

Comments
 (0)