Error Call to undefined method Illuminate Http Request put

0 votes

I need to change value of my request parameter like this:

$request->name = "My Value!";

I use this code but does not work:

$request->offsetSet('img', $img);

I got this error:

Error : Call to undefined method Illuminate\Http\Request::put()

How to solve this?

Nov 11, 2020 in Laravel by kartik
• 37,510 points
2,557 views

1 answer to this question.

0 votes

Hello,

You need to customize the request

$data = $request->all();

You can then pass the name of the field and the value

$data['product_ref_code'] = 1650;

and finally pass the new request

$last = Product::create($data);

Hope it helps!!

Thank You!!

answered Nov 11, 2020 by Niroj
• 82,800 points

Related Questions In Laravel

0 votes
1 answer

How to identify wheather the request is HTTP GET or HTTP POST in Laravel?

Hey, In order to identify the type of ...READ MORE

answered Mar 19, 2020 in Laravel by Niroj
• 82,800 points
1,160 views
0 votes
1 answer

Error:Object of class Illuminate\Database\MySqlConnection could not be converted to string

Hello @kartik, The use keyword is what you need: $id = ...READ MORE

answered Sep 24, 2020 in Laravel by Niroj
• 82,800 points
1,759 views
0 votes
1 answer
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,800 points
16,356 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,800 points
1,886 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,800 points
1,570 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,800 points
23,009 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP