*/ public function schema(JsonSchema $schema): array { return [ 'automation_rule_id' => $schema->string()->description('Id of the automation rule to delete.')->required(), 'space' => $schema->string()->description('Space id. Defaults to the personal space.'), ]; } protected function write(Request $request, User $user): Response { $space = $this->resolveSpace($request, $user); $id = $request->string('automation_rule_id')->toString(); $rule = AutomationRule::query()->forSpace($space)->whereKey($id)->first(); if ($rule === null) { throw ValidationException::withMessages([ 'automation_rule_id' => "No automation rule with id {$id} in space {$space->id}.", ]); } $rule->delete(); return $this->json(['deleted' => true, 'id' => $rule->id]); } }