我在輸入數(shù)據(jù)并弄清楚為什么我的數(shù)據(jù)沒有存儲到數(shù)據(jù)庫中時遇到問題。我嘗試使用資源路由和我的自定義路由代碼,但似乎仍然沒有任何效果。單擊提交似乎只是刷新頁面而沒有顯示錯誤這是我的表格:<div class="container"> <div class="row"> <div class="col-md-12"> <nav class="navbar navbar-expand-sm navbar-dark primary justify-content-between"> <div class="navbar-brand text-dark">Create a Story</div> </nav> <hr class="mt-3"> <form action="{{route('story.store')}}" method="post"> @csrf <div class="row"> <div class="col col-lg-6"> <div class="form-group my-3"> <label for="title">Title</label><br> <input type="text" name="title" id="title" class="w-100 form-control{{ $errors->has('title') ? ' is-invalid' : '' }}" value="{{ old('title') }}" required> @if ($errors->has('title')) <span class="invalid-feedback" role="alert"><strong>{{ $errors->first('title') }}</strong></span> @endif </div> </div> <div class="col col-lg-6"> <div class="form-group my-3"> <label for="category">Category</label><br> <select name="category" id="category" class="w-100 form-control{{ $errors->has('category') ? ' is-invalid' : '' }}" value="{{ old('category') }}" required> <option value="Active" selected>Select Category</option> @foreach ($category as $item) <option value="{{$item->id}}">{{$item->nama}}</option> @endforeach </select> @if ($errors->has('category')) <span class="invalid-feedback" role="alert"><strong>{{ $errors->first('category') }}</strong></span> @endif </div>
1 回答

九州編程
TA貢獻1785條經(jīng)驗 獲得超4個贊
單擊提交似乎只是刷新頁面而沒有顯示錯誤
您的驗證器正在返回帶有錯誤的最后一頁。
將此代碼片段添加到您的刀片
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
此外,在提交之前檢查頁面并轉(zhuǎn)到網(wǎng)絡(luò)選項卡(檢查頂部的保留日志)并繼續(xù)提交,您將獲得有關(guān)所發(fā)生情況的更多詳細信息。
- 1 回答
- 0 關(guān)注
- 126 瀏覽
添加回答
舉報
0/150
提交
取消