Problem when submitting form with laravel 5.2?

0

I've developed a site in Laravel which has a problem with the form because it just does not work and does not display no error on the screen it simply has no action and the strange thing is that localhost the site works for example has an error code that when the user tries to submit the form without filling the fields it displays an error on the screen in localhost it appears already in the hosting it has no action I took a look at log and also does not display anything else anyway it follows log with my code.

Error submitting form without filling in fields ( localhost )

  

Errorsdonotappearinthehosting

  

:

Website address: link

Form:

 @if (count($errors) > 0)
                        <div class="alert alert-danger">
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif

                    @if (session('message'))
                        <div class="alert alert-success">
                            {!! session('message')  !!}
                        </div>
                    @endif

                    {!! Form::open(array('action' => 'FormController@postContato', 'role' => 'form', 'class'=>'form')) !!}
                    <div class="form-group"> 
                        <div class="row">
                            <div class="col-md-6">
                                {!! Form::text('nome', null, array('placeholder'=>'Nome')) !!}
                                {!! Form::text('email', null, array('placeholder'=>'E-mail')) !!}
                                {!! Form::text('telefone', null, array('placeholder'=>'Telefone')) !!}
                            </div>
                            <div class="col-md-6">
                                {!! Form::textarea('mensagem', null, array('placeholder'=>'Mensagem', 'rows'=>'5')) !!}
                                {!! Form::submit('Enviar', array('class' => 'btn btn-success'), array('id' => 'btn_submit')) !!}
                            </div>

                        </div>
                    </div>
                    {!! Form::close() !!}

FormController:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Validator;
use Mail;
use App\Http\Requests;

class FormController extends Controller
{
    public function index() {
        return view('/');
    }


    public function postContato(Request $request) {
        $rules = array( 'nome' => 'required', 'email' => 'required|email', 'telefone' => 'required', 'mensagem' => 'required' );
        $errors = [
            'required'    => 'O campo :attribute é obrigatório.',
            'email'    => 'Digite um email válido.',
        ];
        $validation = Validator::make($request->all(), $rules, $errors);
        $data = array();
        $data['nome'] = $request->input("nome");
        $data['email'] = $request->input("email");
        $data['telefone'] = $request->input("telefone");
        $data['mensagem'] = $request->input("mensagem");

        if($validation->passes()) {
            Mail::send('emails.contato', $data, function($message) use($request){
                $message->from($request->input("email"), $request->input("nome"));
                $message->to('[email protected]') ->subject('contato do site');
                $message->bcc('[email protected]') ->subject('Contato do site');

            });
            return redirect('#contato')->with('message', 'Mensagem enviada com sucesso!');
        }
        return redirect('#contato')->withErrors($validation);
    }
}

Route

<?php

        Route::get('/', function () {
        return view('welcome');
    })->name('home');


    Route::get('coworking',[
        'as' => 'coworking',
        'uses' => 'CoworkingController@index'
    ]);

    Route::get('evento',[
        'as' => 'evento',
        'uses' => 'EventoController@index'
    ]);

    Route::get('sobre',[
        'as' => 'sobre',
        'uses' => 'SobreController@index'
    ]);

    Route::get('criancas',[
        'as' => 'criancas',
        'uses' => 'CriancasController@index'
    ]);

    /*Route::get('contato',[
        'as' => 'contato',
        'uses' => 'ContatoController@index'
    ]);*/

    Route::post('/', 'FormController@postContato');
    
asked by anonymous 01.06.2017 / 15:08

0 answers