Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AlianK's avatar

empty $request

Hello! https://paste.laravel.io/b378f2db-0d00-4bb3-ad44-eff44fdd642d php code, and https://paste.laravel.io/f163239d-af07-4ab4-bc37-be6a17af1788 view, and Route

Route::post('/tools/support/post',['uses'=>'PublicToolsSupportPost@execute','as'=>'form.tools.support']);

why returned dd empty $request?

0 likes
9 replies
Snapey's avatar

Request should ALWAYS be populated even if you did not have any data posted from the form so I'm puzzled what you mean by []empty array

You don't have another dd() statement somewhere do you?

AlianK's avatar

You don't have another dd() statement somewhere do you?

yes, other form works fine. Problem is only in this form

AlianK's avatar

I tried there, everything perfectly. But here the problem

rin4ik's avatar

with this?

Route::post('/tools/support/post'', function () {
    dd(request()->all());
});
AlianK's avatar

rin4ik the controller is fine, I checked it 50 :) circles

{!! Form::open(['url'=>route('form.tools.support'), 'method'=>'POST','enctype'=>'text/plain','class'=>'form-inline','id'=>'model']) !!}

I do a lot of experiments, and found. What a mistake in this piece of code. But I do not understand what.

if I do it like this, it will all work

{!! Form::open(['url'=>route('form.tools.support'),'method'=>'POST','name'=>'Guest']) !!}

Cronix's avatar
Cronix
Best Answer
Level 67

I think it's the enctype of your form (text/plain). Remove it or try using application/x-www-form-urlencoded (which is the default if you don't have an enctype attribute)

Edit: I see you found that

1 like

Please or to participate in this conversation.