【发布时间】:2016-08-25 15:29:38
【问题描述】:
当我提交表单时,我收到以下错误:“RouteCollection.php 第 219 行中的 MethodNotAllowedHttpException”。
我该如何解决这个问题?我查看了各种论坛和其他帖子,其中已经回答了这个问题,但没有一个对我有用。
我的路由文件如下:
<?php
/*
This is the file in which the rules for how users will use the application are kept
*/
Route::get('/',function() {
return view('welcome');
});
Route::auth();
Route::get('/home', 'HomeController@index');
Route::resource('/questionnaires', 'QuestionnairesController');
Route::resource('/questions', 'QuestionsController');
Route::resource('/answers', 'AnswersController');
\
我的 create.blade.php 文件和表单如下所示:
@extends('layouts.master')
@section('title', 'Create Questionnaire | SurveySays!')
@section('content')
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<h1>Create Questionnaire</h1>
<h3>Create your questionnaire using the form below. Give it a title, a small description and write your ethical considerations:</h3>
@if($errors->any())
<div class="alert alert-danger">
@foreach($errors->all() as $error)
<p>{{ $error }}</p>
@endforeach
</div>
@endif
{!! Form::open(array('url' => '/questionnaires/create')) !!}
<div class="container-fluid">
<div class="form-group">
{!! Form::label('title', 'Title:') !!}
{!! Form::text('title',null,['id' => 'title','class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('description', 'Description:') !!}
{!! Form::textarea('description',null,['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('ethics', 'Ethical considerations:') !!}
{!! Form::textarea('ethics',null,['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::submit('Create', array('class' => 'btn btn-success form-control')) !!}
</div>
</div>
</div>
{!! Form::close() !!}
@endsection
谢谢:)
【问题讨论】: