mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-22 11:12:20 +00:00
33 lines
765 B
PHP
33 lines
765 B
PHP
<?php
|
|
|
|
namespace App\Actions\NotificationChannels;
|
|
|
|
use App\Models\NotificationChannel;
|
|
use App\Models\User;
|
|
|
|
class EditChannel
|
|
{
|
|
/**
|
|
* @param array<string, mixed> $input
|
|
*/
|
|
public function edit(NotificationChannel $notificationChannel, User $user, array $input): void
|
|
{
|
|
$notificationChannel->fill([
|
|
'label' => $input['label'],
|
|
'project_id' => isset($input['global']) && $input['global'] ? null : $user->current_project_id,
|
|
]);
|
|
$notificationChannel->save();
|
|
}
|
|
|
|
/**
|
|
* @param array<string, mixed> $input
|
|
* @return array<string, string>
|
|
*/
|
|
public static function rules(array $input): array
|
|
{
|
|
return [
|
|
'label' => 'required',
|
|
];
|
|
}
|
|
}
|