0
私のテーブル内のいくつかの値を編集可能にしたいので、この簡単なカスタムフォームを作成しました。しかし、これは許可されていないHTTP例外のメソッドのエラーをスローされます。何か助け?解決方法が許可されていませんLaravelでのHttp例外5.2
<form action="{{ url('/idx-test/update-this-student/'. $student->id)}}" class="" method="POST">//changing this to put, patch does not solve the error
ルート
Route::post('/idx-test/update-this-student/{id}', '[email protected]'); //again changing this to patch,or put does not help
このコードの小片を添加することによりコントローラ
public function updateThisStudent(StudentRequest $request, $id)
{
$student = Student::findOrFail($id);
$student->update($request->all());
// return redirect('city');
echo "updated";
}
StudentRequest
public function rules()
{
return [
'firstname' => 'required|alpha|min:2|max:10',
'lastname' => 'required|alpha|min:2|max:10',
'bday' => 'required|date',
'address' => 'required|min:10',
'zip' => 'required|min:4|max:10',
'phone' => 'required|digits:7',
'mobile' => 'required|digits:11',
'email' => 'required|email',
'city_id' => 'required',
'yearlevel_id' => 'required',
'section_id' => 'required',
];
}
StudentRequestクラスはどのように見えますか? – henrik
@henrikちょっとしたバリデーション。新しい生徒を追加するときにうまくいきます。私はそれがエラーの原因だとは思わない。いずれにせよ、私は –
という質問をStudentRequestクラスに更新した? –