File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 55use CSlant \GitHubProject \Services \GithubService ;
66use CSlant \GitHubProject \Services \WebhookService ;
77use Illuminate \Http \JsonResponse ;
8+ use Illuminate \Http \Request ;
89use Throwable ;
910
1011class GenerateCommentAction
@@ -22,16 +23,16 @@ public function __construct(WebhookService $webhookService, GithubService $githu
2223 /**
2324 * Generate a comment message from the webhook payload
2425 *
25- * @param array<string, mixed>|object $payload
26+ * @param Request $request
2627 * @param bool $validate Whether to validate the payload (default: true)
2728 *
2829 * @return JsonResponse
2930 * @throws Throwable
3031 */
31- public function __invoke (array | object $ payload , bool $ validate = true ): JsonResponse
32+ public function __invoke (Request $ request , bool $ validate = true ): JsonResponse
3233 {
3334 try {
34- $ payload = is_object ( $ payload ) ? ( array ) $ payload : $ payload ;
35+ $ payload = $ request -> isJson ( ) ? $ request -> json ()-> all () : json_decode ( $ request -> getContent (), true ) ;
3536
3637 if ($ validate ) {
3738 $ validationResponse = $ this ->webhookService ->validatePayload ($ payload );
You can’t perform that action at this time.
0 commit comments