Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel PUT request parameter

Tags:

laravel

When the route is:

  Route::post('/abcd',...); 

Then in controller I get the parameter like this:

   $r->get('param')   // with Request $r

But while the route is of a PUT request type:

   Route::put('/abcd,...);

That code doesn't work. It doesn't get the value of parameter.

like image 273
Sang Trần Avatar asked Mar 08 '16 09:03

Sang Trần


People also ask

How do you pass data in put method?

You can send data to the server in the body of the HTTP PUT request. The type and size of data are not limited. But you must specify the data type in the Content-Type header and the data size in the Content-Length header fields. You can also post data to the server using URL parameters with a PUT request.

What is request () in laravel?

Introduction. Laravel's Illuminate\Http\Request class provides an object-oriented way to interact with the current HTTP request being handled by your application as well as retrieve the input, cookies, and files that were submitted with the request.

What is @param in laravel?

The required parameters are the parameters that we pass in the URL. Sometimes you want to capture some segments of the URI then this can be done by passing the parameters to the URL. For example, you want to capture the user id from the URL.

How do I get params in laravel?

Laravel routes are located in the app/Http/routes. For instance, to pass in a name parameter to a route, it would look like this. Route::get('/params/{name}', function ($name) { return $name }); By convention, the Controller function accepts parameters based on the parameters provided.


1 Answers

Try setting x-www-form-urlencoded for body in the postman.

like image 189
Arthur Avatar answered Sep 22 '22 09:09

Arthur