问题描述
我有这个问题... 我创建了一个新的地点记录,然后我检查它是否存在。
到目前为止一切顺利,但是现在当我想将它链接到某个餐厅时,它返回422 错误。
我一直在寻找答案,但我不明白我做错了什么。
这是我的代码:
public function store(Request $request){
$this->authorize('create',Feeding::class);
$request->validate([
'date' => 'required|date|max:255','food' => 'required|string|max:255','observation' => 'required|string','quantityLunchs' =>'required|integer','user_id' => 'required|exists:users,id','artist_id' => 'required|exists:artists,'place_id' => 'required|exists:places,],self::$messages);
$Feeding = Feeding::create($request ->all());
return response() -> json($Feeding,201); //success
}
我在邮递员中使用的标题:
授权:不记名令牌
接受: application/json
有什么解决办法吗? 坦克你