[英]Laravel Put/Patch Request
Im trying to do a Put/Patch Request, I am using Postman, this is my current Code: 我正在尝试发出放置/修补请求,我正在使用邮递员,这是我当前的代码:
class CustomerController extends Controller
{
public function getAllCustomer()
{
return Customer::get();
}
public function addNewCustomer(Request $request)
{
$validatedData = $request->validate([
'Title' => 'required',
'Name' => 'required|max:255',
'Surname' => 'required|max:255',
'Email' => 'required',
'Phone' => 'required',
'Password' => 'required',
'dateofBirth' => 'required'
]);
return \app\model\Customer::create($request->all());
}
public function update (Request $request , Customer $id)
{
$id->update($request->all());
}
And this my route: 这是我的路线:
Route::put('Customer/{id}' , 'CustomerController@update');
Im trying to insert some Parameters into Postman, but I think the way I do it is not correct, right now I do it like this: 我试图在邮递员中插入一些参数,但是我认为这样做的方式是不正确的,现在我这样做是这样的:
Im not getting any Errors, but nothing is happening, maybe somebody knows a solution. 我没有收到任何错误,但是什么也没有发生,也许有人知道解决方案。 I want to Change the Name of the customer.
我想更改客户名称。 Thanks!
谢谢!
尝试在邮递员中为身体设置x-www-form-urlencoded
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.