Laravel 5 更新控制器中的问题

Laravel 5 更新控制器中的问题,laravel-5,laravel-5.2,Laravel 5,Laravel 5.2,我在更新时遇到了问题 RouteCollection.php第161行中的NotFoundHttpException:RouteCollection.php第161行中的 RouteCollection->match(对象(请求))位于Router.php第821行 Router->findulote(对象(请求))位于Router.php第691行 Router.php第675行中的Router->dispatchToRoute(对象(请求)) 在Kernel.php第246行中的路由器->调

我在更新时遇到了问题 RouteCollection.php第161行中的NotFoundHttpException:RouteCollection.php第161行中的 RouteCollection->match(对象(请求))位于Router.php第821行 Router->findulote(对象(请求))位于Router.php第691行 Router.php第675行中的Router->dispatchToRoute(对象(请求))
在Kernel.php第246行中的路由器->调度(对象(请求)) 内核->照亮\Foundation\Http{closure}(对象(请求))位于 在Pipeline.php中调用_user_func(对象(闭包)、对象(请求)) 第52行在 管道->照明\路由中的{closure}(对象(请求)) CheckFormIntenanceMode.php第44行 CheckFormIntenanceMode->handle(对象(请求)、对象(关闭))
在调用用户函数数组(数组(对象)(CheckFormIntenanceMode)时, Pipeline.php中的数组(对象(请求)、对象(闭包)) 第136行在 管道->照明\管道{closure}(对象(请求))位于 在Pipeline.php中调用_user_func(对象(闭包)、对象(请求)) 第32行在 管道->照明\路由{closure}(对象(请求))位于 在Pipeline.php中调用_user_func(对象(闭包)、对象(请求)) 第103行,在Kernel.php行中的Pipeline->then(object(Closure))处 132在内核->发送请求通过外部(对象(请求))在 在中的Kernel->handle(object(Request))处的Kernel.php第99行 index.php第54行

对于给定问题,这里是我的控制器

public function update(Request $request ,$id){

        print_r($request);
        return redirect()->back();
    }
查看

{!! Form::model($website, ['method' => 'PATCH   ', 'route' => ['websites.update', $website->id]]) !!}`
<div class="form-group">
{{ Form::label('user', 'User Name:', ['class' => 'control-label']) }}
{{ Form::text('user', null, ['class' => 'form-control']) }}
    </div>
{!! Form::submit('Update', ['class' => 'btn btn-primary']) !!}
{!! Form::close() !!}

您的方法不同,应该与route相同 让我们这样改变:

{!! Form::model($website, ['method' => 'PUT', 'route' => ['websites.update', $website->id]]) !!}`
.
.
.


Route::PUT('websites/{id}/update',
    ['as' => 'websites.update', 'uses' => 'WebsiteController@update']
);

谢谢大家帮助我。但是我用这个,现在它工作正常了。再次感谢

 {!! Form::model($website, ['method' => 'PATCH', 'route' => ['websites.update', $website->id]]) !!}`
        .
        .
        .


        Route::any('websites/{id}/update',
            ['as' => 'websites.update', 'uses' => 'WebsiteController@update']
        );

您可以从隐藏字段发送id,但仍不工作。。。请您详细说明,以便我能理解您使用的是方法补丁,但路线是post,它们应该是相同的。修补或发布,但相同。使用类似网站更新的路线
 {!! Form::model($website, ['method' => 'PATCH', 'route' => ['websites.update', $website->id]]) !!}`
        .
        .
        .


        Route::any('websites/{id}/update',
            ['as' => 'websites.update', 'uses' => 'WebsiteController@update']
        );