mardi 23 février 2016

Form on submit always redirect to STORE function in laravel 5.2

i am new to laravel i am trying to create a form with onselect from a dropdown it will take me to a resource control in which i have a function defined with name getCurrency.

Here is how my view looks like:

{!! Form::open([
        'id' => 'form_sample_currency',
        'class' => 'register-form',
        'route'=>'quotes.getCurrency'
]) !!}
                                    <div class="col-md-5">
                                        <select class="form-control select2me selectCurrency" name="user_id"  onchange="user_id.form.submit()">
                                            @foreach($users as $user)
                                                <option value="{{ $user->id}}">{{ $user->name }} 
                                                    @if(!empty($user->companyname))
                                                        ({{ $user->companyname }})
                                                    @else
                                                        ({{ $user->email}})
                                                    @endif
                                                </option> 
                                            @endforeach 
                                        </select>
                                    </div>
{!!Form::close()!!} 

On select it takes me always to a store function.

Here is how i defined my routes in routes.php file:

Route::post('quotes/selectCurrency',[
                    'as' => 'quotes.getCurrency', 'uses' => 'QuoteController@getCurrency'
]);
Route::get('ajaxservices', 'QuoteController@services');
Route::resource('quotes','QuoteController');

And in getCurrency() i just returned dummy text;

What mistake i am doing, why its not redirecting toward the controller function i defined in the URL.

Thank you!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire