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(); } }