-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
global storage-providers, notification channels and server providers (#…
…247)
- Loading branch information
1 parent
ad027eb
commit 11e3b16
Showing
44 changed files
with
678 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace App\Actions\NotificationChannels; | ||
|
||
use App\Models\NotificationChannel; | ||
use App\Models\User; | ||
use Illuminate\Support\Facades\Validator; | ||
use Illuminate\Validation\ValidationException; | ||
|
||
class EditChannel | ||
{ | ||
public function edit(NotificationChannel $notificationChannel, User $user, array $input): void | ||
{ | ||
$this->validate($input); | ||
|
||
$notificationChannel->label = $input['label']; | ||
$notificationChannel->project_id = isset($input['global']) && $input['global'] ? null : $user->current_project_id; | ||
|
||
$notificationChannel->save(); | ||
} | ||
|
||
/** | ||
* @throws ValidationException | ||
*/ | ||
private function validate(array $input): void | ||
{ | ||
$rules = [ | ||
'label' => [ | ||
'required', | ||
], | ||
]; | ||
Validator::make($input, $rules)->validate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace App\Actions\ServerProvider; | ||
|
||
use App\Models\ServerProvider; | ||
use App\Models\User; | ||
use Illuminate\Support\Facades\Validator; | ||
use Illuminate\Validation\ValidationException; | ||
|
||
class EditServerProvider | ||
{ | ||
public function edit(ServerProvider $serverProvider, User $user, array $input): void | ||
{ | ||
$this->validate($input); | ||
|
||
$serverProvider->profile = $input['name']; | ||
$serverProvider->project_id = isset($input['global']) && $input['global'] ? null : $user->current_project_id; | ||
|
||
$serverProvider->save(); | ||
} | ||
|
||
/** | ||
* @throws ValidationException | ||
*/ | ||
private function validate(array $input): void | ||
{ | ||
$rules = [ | ||
'name' => [ | ||
'required', | ||
], | ||
]; | ||
Validator::make($input, $rules)->validate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace App\Actions\StorageProvider; | ||
|
||
use App\Models\StorageProvider; | ||
use App\Models\User; | ||
use Illuminate\Support\Facades\Validator; | ||
use Illuminate\Validation\ValidationException; | ||
|
||
class EditStorageProvider | ||
{ | ||
public function edit(StorageProvider $storageProvider, User $user, array $input): void | ||
{ | ||
$this->validate($input); | ||
|
||
$storageProvider->profile = $input['name']; | ||
$storageProvider->project_id = isset($input['global']) && $input['global'] ? null : $user->current_project_id; | ||
|
||
$storageProvider->save(); | ||
} | ||
|
||
/** | ||
* @throws ValidationException | ||
*/ | ||
private function validate(array $input): void | ||
{ | ||
$rules = [ | ||
'name' => [ | ||
'required', | ||
], | ||
]; | ||
Validator::make($input, $rules)->validate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.