Я пытался получить значение данных формы, нажав кнопку отправки на блейде, чтобы направить маршрут с именем пациента / обновления. Я пытаюсь проверить объект $request
на контроллере, используя var_dump()
. Однако было сообщение об ошибке
«Метод GET не поддерживается для этого маршрута».
Я пытался перейти от получения к сообщению. Но все же я не могу понять, в чем заключается ошибка.
Вот мой код на блейде;
<form class="" action="{{ route('patient/update') }}" metdod="post">
@csrf
<nav class="nav">
<a href="{{ route('home') }}">
<button class="btn btn-secondary mr-2 mb-2" type="button" name="button">Home</button>
</a>
<input type="submit" class="btn btn-primary mb-2" name="save" value="Save">
</nav>
<table class="table">
<tr>
<td>
<label class="text-primary">Fullname</label>
<input class="form-control" type="text" name="fullname" value="{{ $patient->fullname }}" />
</td>
<td>
<label class="text-primary">Date of birth</label>
<input class="form-control" type="date" name="date_of_birth" value="{{ $patient->date_of_birth }}" />
</td>
<td>
<label class="text-primary">Sex</label>
<input class="form-control" type="text" name="sex" value="{{ $patient->sex }}" />
</td>
<td>
<label class="text-primary">Birth weight</label>
<input class="form-control" type="text" name="birth_weight" value="{{ $patient->birth_weight }}" />
</td>
<td>
<label class="text-primary">Birth length</label>
<input class="form-control" type="text" name="birth_length" value="{{ $patient->birth_length }}" />
</td>
</tr>
<tr>
<td colspan="2">
<label class="text-primary">Birth History</label>
<textarea class="form-control" name="birth_history" rows="3" cols="30">{{ $patient->history }}</textarea>
</td>
<td colspan="2">
<label class="text-primary">Feeding: </label>
<textarea class="form-control" name="feeding" rows="3" cols="30">{{ $patient->feeding }}</textarea>
</td>
<td colspan="2">
<label class="text-primary">screening_date: </label>
<input class="form-control" type="date" name="screening_date" value="{{ $patient->screening_date }}" />
</td>
</tr>
<tr>
<td colspan="2">
<label class="text-primary">Home Address</label>
<textarea class="form-control" name="home_address" rows="3" cols="30">{{ $patient->home_address }}</textarea>
</td>
</tr>
<tr>
<td>
<label class="text-primary">Mother's name</label>
<input class="form-control" type="text" name="mother_name" value="{{ $patient->mother_name }}" />
</td>
<td>
<label class="text-primary">Age</label>
<input class="form-control" type="text" name="mother_age" value="{{ $patient->mother_age }}" />
</td>
<td>
<label class="text-primary">Occupation</label>
<input class="form-control" type="text" name="mother_occupation" value="{{ $patient->mother_occupation }}" />
</td>
<td>
<label class="text-primary">Contact No.</label>
<input class="form-control" type="text" name="mother_cp" value="{{ $patient->mother_cp }}" />
</td>
<td>
<label class="text-primary">TT Status</label>
<input class="form-control" type="text" name="mother_tt_status" value="{{ $patient->mother_tt_status }}" />
</td>
</tr>
<tr>
<td>
<label class="text-primary">Father's Name</label>
<input class="form-control" type="text" name="father_name" value="{{ $patient->father_name }}" />
</td>
<td>
<label class="text-primary">Age</label>
<input class="form-control" type="text" name="father_age" value="{{ $patient->father_age }}" />
</td>
<td>
<label class="text-primary">Occupation</label>
<input class="form-control" type="text" name="father_occupation" value="{{ $patient->father_occupation }}" />
</td>
<td>
<label class="text-primary">Contact No.</label>
<input class="form-control" type="text" name="father_cp" value="{{ $patient->father_cp }}" />
</td>
</tr>
</table>
<input type="submit" class="btn btn-primary m-2 " name="save" value="Save">
</form>
Вот мой маршрут;
Route::post('/patient/update', 'PatientController@update')->name('patient/update');
И вот мой контроллер;
public function update(Request $request)
{
var_dump($request);
}
Кто-нибудь может объяснить мне, почему происходит эта ошибка?
Спасибо, если возможно, вы можете показать мне решение!