我正在尝试创建一个表单来存储一些数据。但是,当我单击提交按钮时,除了刷新页面外没有任何反应。请求被触发(显示在 DevTools -> Network 中)。路线应该没问题,因为它在一个小时前工作,现在不行了。我从表单中删除了每个输入,只是为了看看是否可以从控制器调用存储函数。然而,没有运气。
表格:
<form method="POST" action="{{route('bookings.store')}}" enctype="multipart/form-data">
@csrf
<input type="submit"/>
</form>
控制器(应该只在页面上打印字符串,但没有):
public function store(Request $request)
{
$this->validate($request, [
'nume' => 'required',
'description' => 'required'
]);
return "wtf";
路线清单:
| Domain | Method | URI | Name | Action | Middleware |
+--------+-----------+-------------------------+------------------+------------------------------------------------------------------------+--------------+
| | GET|HEAD | / | | Closure | web |
| | GET|HEAD | about | about | App\Http\Controllers\PageController@about | web |
| | GET|HEAD | api/user | | Closure | api,auth:api |
| | POST | bookings | bookings.store | App\Http\Controllers\BookingController@store | web,auth |
| | GET|HEAD | bookings | bookings.index | App\Http\Controllers\BookingController@index | web |
| | GET|HEAD | bookings/create | bookings.create | App\Http\Controllers\BookingController@create | web,auth |
| | PUT|PATCH | bookings/{booking} | bookings.update | App\Http\Controllers\BookingController@update | web,auth |
神不在的星期二