samedi 28 novembre 2015

Laravel5 : MethodNotAllowedHttpException

When I'm trying to post something with the form it gives this Error.

This is my route:

// CONTESTS
Route::get('contests', 'ContestsController@index'); <br>
Route::get('applycontest', 'ApplyContestController@index'); <br>
    // ->post <br>
    Route::post('applycontest', 'ContestsController@store'); <br>

This is my view:

@extends('app')
@if (Auth::check())
@section('content')
    <div class="contestbanner">
          <p class="contestbanner-heading">A LITTLE CONTEST NEVER HURT NOBODY</p>
    </div>
    <div class="apply">
        <h1>Apply for our contest!</h1>

        {!! Form::open(array('url' => 'contests', 'files' => true)) !!}
            {!! Form::label('title', 'Title:') !!}
            {!! form::text('title', null, ['class' => 'form-control', 'autofocus']) !!}

            {!! Form::label('desc', 'Description: ') !!}
            {!! form::textarea('desc', null, ['class' => 'form-control']) !!}

            {!! Form::label('image', 'Add an image') !!}
            {!! form::file('image', null, ['class' => 'form-control'])!!}

            <br/>

            {!! Form::Submit('Add your work', ['class' => 'btn btn-primary form-control']) !!}

        {!! Form::close() !!}
    </div>
@else 
    @section('message')
        @include('includes.anonymous')
    @stop
@endif

    <div class="back">
        <a class="back-button" href="contests">Go back</a>
    </div>

@stop           
@stop

This is the controller:

http://ift.tt/1IgUMJn

Thanks in advance!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire