Php 修改按钮不';尽管我称之为补丁方法'@方法(';补丁';)';,我想显示文档,但它没有';不出现

Php 修改按钮不';尽管我称之为补丁方法'@方法(';补丁';)';,我想显示文档,但它没有';不出现,php,laravel,Php,Laravel,当我点击编辑按钮时,编辑不起作用,它会恢复输入值,但不会在数据库中修改它 Edit.blade.php @extends('index') @section('content') <script language="javascript" type="text/javascript" src={{ URL::to('js/extension.js') }}></script> <div class="form-group" style="margin

当我点击编辑按钮时,编辑不起作用,它会恢复输入值,但不会在数据库中修改它

Edit.blade.php

@extends('index')
@section('content')
    <script language="javascript" type="text/javascript" src={{ URL::to('js/extension.js') }}></script>
    <div class="form-group" style="margin-top: 100px;">
        <form class="forms-sample" action="/documentSideBar" method="get" enctype="multipart/form-data">
            @csrf
            @method('PATCH')
            <div class="form-group">
                <label for="nomDocument">Nom document</label>
                <input type="text" class="form-control" id="nomDocument" name="nomDocument"
                       value="{{$document->nomDocument}}" onChange='getoutput2()'>
            </div>
            <div class="form-group">
                <label for="description">Description</label>
                <input type="text" class="form-control" id="description" name="description"
                       value="{{$document->description}}">
            </div>

            <div class="row">
                <div class="col-md-6">
                    <div class="form-group row">
                        <label class="col-sm-3 col-form-label">Type</label>
                        <div class="col-sm-9">
                            <select class="form-control">
                                <option>Documents administratifs</option>
                                <option>Documents financiéres</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label for="fille">Importer un fichier</label>
                <input type="file" onChange='getoutput()' name="file" id="fille" class="form-control">
                <input id='extension' type='hidden' name='extension'>
                <input id="pathe" type="hidden" name="path">
            </div>
            <button type="submit" class="btn btn-success mr-2">Modifier</button>
            <button class="btn btn-light">Annuler</button>

        </form>
    </div>
@endsection
<td style="width:300px">
                                                    <a href="/download/{{$document->id}}" class="btn btn-success"><i
                                                                class="glyphicon glyphicon-download-alt"></i></a>

                                                    <a href="/documentSideBar/{{$document->id}}/edit" style="float:right" class="btn btn-primary">
                                                        <i class="glyphicon glyphicon-edit"></i>
                                                    </a>

                                                    <form action="{{ action('DocumentsController@destroy', $document->id)}}" method="POST">
                                                        @method('DELETE')
                                                        @csrf
                                                        <button class="btn btn-danger"><i
                                                                    class="glyphicon glyphicon-trash"></i></button>
                                                    </form>
                                                </td>
我还想调整按钮,我不知道如何在它们之间留出空间


您应该将表单方法更改为POST,并将操作更改为资源模式:

 <form class="forms-sample" action="{{route('documentSideBar.update', $document->id)}}" method="POST" enctype="multipart/form-data"
   @csrf
   @method('PATCH')

错误在web.php中:以下是正确的路径

Route::resource('documentSideBar','DocumentsController');

Route::get('download/{id}','DocumentsController@download');

Route::get('show/{id}','DocumentsController@show');

Route::post('/update/{id}','DocumentsController@update');

我已经尝试过了,但是我遇到了这个错误,这个路径不支持补丁方法。支持的方法:GET、HEAD、POST。如上文所述,在您的表单标签中,在blade指令
方法(“补丁”)上放置的补丁方法,方法应该是post,如果您要更新文档中的所有属性,则应该使用PUT方法。我按照您所说的那样尝试,但它不起作用。我不知道路由或方法中是否有错误,@csrf@method('PATCH')很抱歉,迟到了,这是路由:route::resource('documentSideBar','DocumentsController');路由::get('download/{id}','DocumentsController@download);路由::get('show/{id}','DocumentsController@show');路由::post('/update/{id}','DocumentsController@update);但我要把它改成这样你应该把这个放在你的问题上
Route::resource('documentSideBar','DocumentsController');

Route::get('download/{id}','DocumentsController@download');

Route::get('show/{id}','DocumentsController@show');

Route::post('/update/{id}','DocumentsController@update');