我正在尝试更改管理员密码,但它说:路由[/ admin / update-pwd]未定义。我该如何更改?
控制器:
<form method="POST" action="{{ route('/admin/update-pwd') }}" enctype="multipart/form-data">
@csrf
@method('PATCH')
<strong class="text-muted d-block mb-2">Enter Current Password</strong>
<div class="input-group mb-3">
<div class="input-group input-group-seamless">
<input type="password" name="current_pwd" class="form-control @error('password') is-invalid @enderror" id="form2-password" placeholder="Password">
<span class="input-group-append">
<span class="input-group-text">
<i class="material-icons">lock</i>
</span>
</span>
</div>
</div>
<strong class="text-muted d-block mb-2">Enter New Password</strong>
<div class="input-group mb-3">
<div class="input-group input-group-seamless">
<input type="password" name="new_pwd" class="form-control @error('password') is-invalid @enderror" id="form2-password" placeholder="Password">
<span class="input-group-append">
<span class="input-group-text">
<i class="material-icons">lock</i>
</span>
</span>
</div>
</div>
<strong class="text-muted d-block mb-2">Confirm New Password</strong>
<div class="input-group mb-3">
<div class="input-group input-group-seamless">
<input type="password" name="confirm_pwd" class="form-control @error('password') is-invalid @enderror" id="form2-password" placeholder="Password">
<span class="input-group-append">
<span class="input-group-text">
<i class="material-icons">lock</i>
</span>
</span>
</div>
</div>
@error('password')
<div class="small text-danger">{{ $message }}</div>
@enderror
<button type="submit" class="mb-2 btn btn-primary mr-2">Update Password</button>
</form>
刀片文件:
Route::get('/admin/changepassword', 'ChangepasswordController@changepassword');
Route::get('/admin/check-pwd','AdminController@chkPassword');
Route::match(['get', 'post'],'/admin/update-pwd','AdminController@updatePassword');
路线:
integer fin_pointer,fout_pointer;
reg usigned;
reg [31:0] dividend,divisor;
task ee_se;
begin
fin_pointer= $fopen("../../../../tbench/se_ee_in.txt","r");
if (fin_pointer==0)
begin
$display("Could not open file '%s' for reading","se_ee_in.txt");
$stop;
end
fout_pointer= $fopen("../../../../se_ee_out.txt","w");
if (fout_pointer==0)
begin
$display("Could not open file '%s' for writing","se_ee_out.txt");
$stop;
end
// @(posedge rst_n);
// @(posedge clk);
# 100;
while (! $feof(fin_pointer)) begin
$fscanf(fin_pointer,"%b %b %b\n",usigned,dividend,divisor);
// valid=1;
// @(posedge clk);
#100 ;
// valid=0;
// @(posedge res_ready);
$fwrite(fout_pointer,"%b %b\n",~dividend,~divisor);
end
$finish;
$fclose(fin_pointer);
$fclose(fout_pointer);
end
endtask
答案 0 :(得分:1)
使用route
助手时,它期望您提供的是路由名称而不是URI,因此添加以下内容:
Route::match(['get', 'post'],'/admin/update-pwd','AdminController@updatePassword')
->name('admin.update_password');
然后在您的视图中可以使用:
route('admin.update_password');
或改为使用url
帮助方法:
// instead of this
{{ route('/admin/update-pwd') }}
//use
{{ url('/admin/update-pwd') }}
答案 1 :(得分:0)
您正在尝试在表单方法中使用Laravel命名路由。使用Laravel Named Routed,然后在表单中定义它。
//在web.php内部
Route::post('/admin/update-pwd','AdminController@updatePassword')->name('admin/update-pwd');
然后您将可以在内部表单中使用
<form method="POST" action="{{ route('/admin/update-pwd') }}" enctype="multipart/form-data">