Request select returning null value

0

Good afternoon, I'm having trouble getting the value of a select in the form below:

{{Form::open(array('action' => 'FilterController@EstatisticaEsic', 'class' => 'form-filter'))}}
            <div class="col-md-2 col-sm-12 col-xs-12 divEstatic-3">
               {{Form::label('mesEsic', 'Selecione o mês')}} 
            </div>
            <div class="col-md-2 col-sm-12 col-xs-12 divEstatic-4 selectEstatic">
                {{Form::select('mesEsic', array('0' => 'Selecione', '01' => 'Janeiro', '02' => 'Fevereiro',
                            '03' => 'Março', '04' => 'Abril', '05' => 'Maio', '06' => 'Junho', '07' => 'Julho',
                            '08' => 'Agosto', '09' => 'Setembro', '10' => 'Outubro', '11' => 'Novembro',
                            '12' => 'Dezembro'), null, ['class' => 'form-control estaticForm'])}}


        {{Form::submit('Visualizar', ['class' => 'btn btn-info btnEstatic'])}}
    </div>
    {{Form::close()}}

I did this, created the route:

Route::post('/EstatisticaEsic', 'FilterController@EstatisticaEsic');

And the method in the controller:

public function EstatisticaEsic(Request $request)
    {
//        $mes = ($request->mesEsic ? $request->mesEsic : 0);
//        $mes = Input::get('mesEsic');
        $mes = $request->input('mesEsic');

        $table = DB::table('pedido_esic')
//                ->where(DB::raw("SUBSTR(created_at, 6, 2)"), '=', $mes)
                ->select(DB::raw("(Select count(id) from pedido_esic) as a"), 
                        DB::raw("(Select count(id) from pedido_esic where situacao = 'Respondido') as b"),
                        DB::raw("(Select count(id) from pedido_esic where situacao = 'Em Tramitação') as c"))
                ->get();


//        return $mes;
        return ['table' => $table[0], 'mes' => $mes];
    }

Then I created a function in javascript getting the object of the route and filling certain divs:

$(function (){
    $('.btnEstatic').on('click', function (event){

        event.preventDefault();

//        $.post($(this).attr('href'))
            $.post('../public/EstatisticaEsic')
                .done(function (json){
                console.log(json.mes);
                        $('.divEstaticRegis').html('');
                        $('.divEstaticResp').html('');
                        $('.divEstaticIndef').html('');

                        $('.divEstaticRegis').html(json.table.a);
                        $('.divEstaticResp').html(json.table.b);
                        $('.divEstaticIndef').html(json.table.c);
                }).error(function (json){console.log(json);
                $('body').html(json.responseText);});
    });
});
The problem is that my select in the form does not match as it should, its return is only as "null" tried, tried and did not succeed, when I return the variable $ mes by the controller itself returns me correctly, but if I play it inside the database search or as object in java script the return is always "null", could anyone help me please? What am I missing?

    
asked by anonymous 05.08.2016 / 20:02

0 answers