vendredi 26 août 2016

MethodNotAllowedHttpException RouteCollection.php line 218

I try to pass a value by post to post.... I take the select value and send it at create file, after this the user compile other form and send it to other route post and check the validation... But don't work ->Route.php

Route::get('administrator/','AdministratorController@index');
Route::get('administrator/select','AdministratorController@select');
Route::post('administrator/create','AdministratorController@create');
Route::post('administrator','AdministratorController@store');

->AdministratorController

    public function create(Request $request){

    $chapterS=SubChapters::where('ChapterName',$request->chapters)->get();
    return view('administrator_pages.create',compact('chapterS','request'));
   }

        public function store(Request $request){
        //dd($request->all());
            $this->validate($request,['IdQuestion'=>'required']);
            return 'store';
        }

->administrator_pages.create

@extends('app')

@section('content')




<div class="input-group">
        <span class="input-group-addon" id="basic-addon1">Capitolo Scelto:</span>
        {!! Form::text('Chapter',$request->chapters,['class'=>'form-control','readonly'=>'readonly']) !!}
</div>

<br>

<div class="input-group">
    <span class="input-group-addon" id="basic-addon1">Sotto Capitolo: </span>

        <div class="dropdown">


          <select name="SubChapterID"class="btn btn-default dropdown-toggle">
            @foreach($chapterS as $chapter)
                <option value=""></option>
            @endforeach

            </select>

        </div>

</div><!--//SUBCHAPTERID-->
<br>

<div class="input-group">
    <span class="input-group-addon" id="basic-addon1">Id Domanda :</span>

    {!! Form::text('IdQuestion',null,['class'=>'form-control']) !!}
</div><!-- ID QUESTION -->
    <br>
<div class="input-group">
    <span class="input-group-addon" id="basic-addon1">Immagine: </span>

    {!! Form::text('UrlImg',null,['class'=>'form-control']) !!}
</div><!-- URL IMG-->
    <br>
<div class="input-group">
    <span class="input-group-addon" id="basic-addon1">Domanda:</span>

    {!! Form::textarea('Contenent',null,['class'=>'form-control','rows'=>'5']) !!}
</div><!-- Contenet -->
    <br>



        <div class="input-group">

            <span class="input-group-addon" id="basic-addon1">Risposta:</span>
            <!-- <div class="form-control">&nbsp;-->&nbsp; &nbsp;
{!!            Form::radio('Answer', 'Vero') !!} Vero     &nbsp; &nbsp;
{!!            Form::radio('Answer', 'Falso') !!} Falso

</div>

<!-- </div>-->



    <br>
<div class="input-group">
    <span class="input-group-addon" id="basic-addon1">Spiegazione:</span>

    {!! Form::textarea('Explanation',null,['class'=>'form-control','rows'=>'5']) !!}
</div><!-- Explanation-->
    <br>

    {!! Form::submit('Avanti',['class'=>'btn btn-default']) !!}

@if($errors->any())

    <ul class="alert alert-danger">
        @foreach($errors->all() as $error)
            <li></li>
        @endforeach
    </ul>

@endif



@stop

->Error

 1/1 MethodNotAllowedHttpException in RouteCollection.php line 218:

    in RouteCollection.php line 218
    at RouteCollection->methodNotAllowed(array('POST')) in RouteCollection.php line 205
    at RouteCollection->getRouteForMethods(object(Request), array('POST')) in RouteCollection.php line 158
    at RouteCollection->match(object(Request)) in Router.php line 821
    at Router->findRoute(object(Request)) in Router.php line 691
    at Router->dispatchToRoute(object(Request)) in Router.php line 675
    at Router->dispatch(object(Request)) in Kernel.php line 246
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
    at CheckForMaintenanceMode->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
    at Pipeline->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in Kernel.php line 132
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
    at Kernel->handle(object(Request)) in index.php line 54



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire