gabrielfrohlich's avatar

Request Data not showing in Laravel Request

Hello People, are you OK?

I have this code here


const form = new FormData
form.set('test[test]',  'test')
form.set('test2[]', 'tessst')

await axios.patch('/model/1',form)

And in the Laravel, i do this:

dd($request->all())

And it returns an empty array. what I am doing wrong?

0 likes
7 replies
vincent15000's avatar

That's not a Laravel problem.

Are you using InertiaJS ?

1 like
jlrdw's avatar

Also what shows in console using dev tools?

1 like
gabrielfrohlich's avatar

@vincent15000

For a example, I have created this inside my routes/web.php

Route::patch('/test', function (Request $request) {
    dd($request->all());
});

And in the console on browser I runned this:

const form = new FormData
form.set('test[test]',  'test')
form.set('test2[]', 'tessst')

await axios.patch('/test',form)

Now I tryed it with POST method too, and with POST it works normally

1 like
Snapey's avatar

and your dd is in TenantController?

1 like

Please or to participate in this conversation.