10 months ago

Form submit not working

Posted 10 months ago by Shoken

I've been stuck with this issue for serveral hours, so hopefully some of you can help. Thanks in advance.

The issue is simple: when I click the form's submit button, nothing happens. Like, literally nothing. No errors, anything. Before starting developing the form I had created the Message model by doing

php artisan make:model Message --resource

Thus I have the methods create, store etc.. already done and ready (thanks artisan!). In my route web.php route file, I have:


This should automatically link all the methods, right?

Anyway, my form is:

{!!  Form::open(['action' => '[email protected]', 'method' => 'POST']) !!}
                                    <ul class="row">
                                        <li class="col-sm-6">
                                                {{Form::text('name', '', ['class' => 'form-control'])}}
                                        <li class="col-sm-6">
                                                {{Form::text('email', '', ['class' => 'form-control', 'placeholder' => 'Your email'])}}
                                        <li class="col-sm-12">
                                                {{Form::textarea('message','', ['class' => 'form-control'])}}
                                        {{Form::submit('Submit', ['class' => 'btn-round'])}}

                                    {!! Form::close() !!}

and my [email protected] looks like this:

 public function store(Request $request)
        $this -> validate($request, [
            'name' => 'required',
            'email' => 'required',
            'message' => 'required'

        $message = new Message();
        $message -> name= $request -> input('name');
        $message -> email= $request -> input('email');
        $message -> text= $request ->input('text');
        $message -> user_id = Auth::user()->id;


        return redirect('/');

The controller just doesn't seem to work because even if I cut validation, nothing happens. I have no clue what I'm doing wrong!

Please sign in or create an account to participate in this conversation.