Php 提交表单按钮不起作用laravel 5.7

Php 提交表单按钮不起作用laravel 5.7,php,laravel,Php,Laravel,我有两种情况需要用户更新调用数据库上的记录。一种是将调用分配给工程师(我已经成功实现了这一点)。第二个是当一个调用要关闭时。我有两个控制器;一个处理第一个进程,第二个closeCallsController处理第二个进程 我正试图用此表单更新调用数据库中的记录 <form action="{{route('Call.update', $calls->id)}}" method="POST"> @csrf {{method_field('PATCH')}}

我有两种情况需要用户更新
调用
数据库上的记录。一种是将
调用
分配给工程师(我已经成功实现了这一点)。第二个是当一个
调用
要关闭时。我有两个控制器;一个处理第一个进程,第二个
closeCallsController
处理第二个进程

我正试图用此表单更新
调用
数据库中的记录

<form action="{{route('Call.update', $calls->id)}}" method="POST">

    @csrf
    {{method_field('PATCH')}}
    <div class="col-md-6">
        <div class="input-group" style="width: 100%;">
            <label for="terminal_id">{{ __('Terminal ID') }}</label><br>
            <input type="text" name="terminal_id" id="terminal_id" class="form-control" value="{{$calls->terminal_id}}" style="padding: 20px;" readonly>
        </div>
    </div>
    <div class="col-md-6">
        <div class="input-group col-md-12" style="width: 100%;">
            <label for="terminal_name">{{ __('Terminal name') }}</label><br>
            <input type="text" name="terminal_name" id="terminal_name" class="form-control" value="{{$calls->terminal_name}}" style="padding: 20px;" readonly>
        </div>
    </div>

    <div class="col-md-6">
        <div class="input-group" style="width: 100%;">
            <label for="closed_on">{{ __('Date and time of closure') }}</label><br>
            <input type="datetime-local" name="closed_on" id="closed_on" class="form-control" style="padding: 20px;" required>
        </div>
    </div>

    <div class="input-group col-xs-6 form-group">
        <label for="operations_comment">{{ __('Comment') }}</label><br>
        <textarea name="operations_comment" id="operations_comment" class="form-control" rows="5" cols="20"  required></textarea>
    </div>
    <button type="submit" class="btn-primary" style="padding: 10px; font-size: 16px; border: 0;">{{ __('Submit') }}</button>
</form>
这是我的路线

Route::get('/pages/closeCall/{id}', 'CloseCallsController@edit');
Route::resource('CloseCalls', 'CloseCallsController');
这是我的
呼叫
型号

class Call extends Model{

protected $fillable = [
'terminal_id',
'terminal_name',
'call_status',
'pending_on',
'closed_on',
'operations_comment',
'closed_by'
];

//describing a one-to-many-relationship between calls and users
public function user(){

return $this->belongsTo('App\User');
}   

请告诉我如何修复此问题?

您没有在更新表单操作中提供的任何名为Call route的路由

试试这个

<form action="{{route('CloseCalls.update', $calls->id)}}" method="POST"></form>

您没有在更新表单操作中提供的任何名为Call route的路由

试试这个

<form action="{{route('CloseCalls.update', $calls->id)}}" method="POST"></form>

我更新了我的路线,就像@Jasim正确地说的那样,但表单仍然没有提交。在一些测试之后,我发现代码在验证过程中会中断,因此,我添加了

@if ($errors->any())
<div class="alert alert-danger">
    <ul>
        @foreach ($errors->all() as $error)
        <li>{{ $error }}</li>
        @endforeach
    </ul>
</div>
@endif
@if($errors->any())
    @foreach($errors->all()作为$error)
  • {{$error}}
  • @endforeach
@恩迪夫

就在
@csrf
之前,为了显示错误,我发现表单中没有包含
pending_on
字段,但在验证检查中将其设置为
required
。所以,我只是简单地删除了它,代码就起作用了……谢谢大家。

我更新了我的路线,就像@Jasim正确地说的那样,但表单仍然没有提交。在一些测试之后,我发现代码在验证过程中会中断,因此,我添加了

@if ($errors->any())
<div class="alert alert-danger">
    <ul>
        @foreach ($errors->all() as $error)
        <li>{{ $error }}</li>
        @endforeach
    </ul>
</div>
@endif
@if($errors->any())
    @foreach($errors->all()作为$error)
  • {{$error}}
  • @endforeach
@恩迪夫

就在
@csrf
之前,为了显示错误,我发现表单中没有包含
pending_on
字段,但在验证检查中将其设置为
required
。因此,我只是简单地删除了它,代码就可以运行了…谢谢大家

尝试检查表单中的元素检查可能为空的操作属性尝试检查表单中的元素检查可能为空的操作属性