我想从带有索引的数据库中获取客户信息。在同一页面上,我想在不创建编辑页面的情况下更新此信息。但是每当编辑数据并按下按钮时,我都会收到“419|页面已过期”错误。你能给我一个想法吗?先感谢您..我的 index.blade.php 是 <div class="widget-body clearfix"> @foreach($posts as $post) <form method="POST" action="{{ route('front.home.index') }}" enctype="multipart/form-data"> <div class="form-group row customerinfo--area"> <div class="col-md-4"> <label class="col-form-label" for="l0">Name</label> <input value="{{$post->customername}}" class="form-control" name="customername" type="text"> </div> <div class="col-md-4"> <label class="col-form-label" for="l0">Email</label> <input value="{{$post->email}}" class="form-control" name="email" type="text"> </div> <div class="form-actions"> <div class="form-group row"> <div class="col-md-12 ml-md-auto btn-list"> <button class="btn btn-primary btn-rounded" type="submit">Save</button> </div> </div> </div> </form> @endforeach </div>我的 indexController 是<?phpnamespace App\Http\Controllers\front\home;use Illuminate\Http\Request;use App\Http\Controllers\Controller;use Illuminate\Support\Facades\DB;use App\Customers;class indexController extends Controller{ public function index() { $posts=DB::select("select * from `customers` where id=1"); return view('front.home.index',['posts'=>$posts]); } public function edit(Request $request) { $all = $request->except('_token'); $data = Customers::where('id','1')->get(); $update = Customers::where('id','1')->update($all); if($update) { return redirect()->back()->with('status','Customer was edited'); } else { return redirect()->back()->with('status','Customer was not edited'); } } }
1 回答
- 1 回答
- 0 关注
- 146 浏览
添加回答
举报
0/150
提交
取消