mercredi 30 septembre 2015

Laravel 5 , submit form doesnt work

i have a problem...

I can't submit a form with laravel , actualy nothing even happens , no errors is shown... Page just stays the same as it was...

This is my route file:

Route::resource('/', 'WebsiteController');

Route::controllers([
    'auth' => 'Auth\AuthController',
    'password' => 'Auth\PasswordController',
]);

This is file with form:

<div class="col-lg-12">
                {!! Form::open(['url' => '/']) !!}
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group wow fadeInLeft">
                            {!! Form::text('name',null,['class'=>'form-control','placeholder'=>'Your name *','id'=>'name']) !!}
                        </div>
                        <div class="form-group wow fadeInLeft">
                            {!! Form::text('email',null,['class'=>'form-control','placeholder'=>'Your email *','id'=>'email']) !!}
                        </div>    
                        <div class="form-group wow fadeInLeft">
                            {!! Form::text('phone',null,['class'=>'form-control','placeholder'=>'Your phone *','id'=>'phone']) !!}
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group wow fadeInRight">
                            {!! Form::textarea('message',null,['class'=>'form-control','placeholder'=>'Your message *','id'=>'message']) !!}    
                        </div>
                    </div>
                    <div class="clearfix"></div>
                        <div class="col-lg-12 text-center wow bounceIn">
                            {!! Form::submit('Click Me!') !!}
                        </div>
                </div>    
                {!! Form::close() !!}

                @if ($errors->any())
                <ul class='alert alert-danger' style='list-style: none;'>
                    @foreach($errors->all() as $error)
                    <li>{{ $error }}</li>
                    @endforeach
                </ul>
                @endif
            </div>

This is my CreateContactRequest file:

<?php namespace App\Http\Requests;

use App\Http\Requests\Request;

class CreateContactRequest extends Request {

/**
 * Determine if the user is authorized to make this request.
 *
 * @return bool
 */
public function authorize()
{
    return true;
}

/**
 * Get the validation rules that apply to the request.
 *
 * @return array
 */
public function rules()
{
    return [
                    'name'  => 'required|min:3',
                    'phone' => 'required',
                    'email' => 'required|email',
                    'message' => 'required'
    ];
}

}

And finally, this is my store method in WebsiteController:

public function store(CreateContactRequest $request)
{
            $this->createContact($request);

}

Included files on top of the WebsiteController file:

use App\Contact;
use App\Http\Requests;
use App\Http\Requests\CreateContactRequest;
use Illuminate\HttpResponse;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
use Request;

Any help is welcomed and appreciated,thanks in advance...



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1WyYhOw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire