vendredi 17 février 2017

Route Parameters not working in laravel

I have a problem with route parameters in laravel, Here is the main.blade.php :

    <body>
<div class="flex-center position-ref full-height">
    <div class="content">
        <div class="title m-b-md">
            Generate Your Domain Now
        </div>
        {!! Form::open(['route'=>'generatorindex' , 'method' => 'post']) !!}
            <input type="hidden" name="_token" value="{!! csrf_token() !!}">
            <input name="inputkeyword" type="text" placeholder="Enter your keyword">
            <button type="submit" value="Generate"></button>
        {!! Form::close() !!}

    </div>
</div>
</body>

and here is the function in controller :

public function generator(Request $inputkeyword)
    {
        echo $productname = $inputkeyword->input('inputkeyword');

    }

finally, here is the route :

Route::any('/generator/{inputkeyword}', [ 'as' => 'generatorindex', 'uses' => 'MainController@generator' ]);

but it returns :

    ErrorException in UrlGenerationException.php line 17:
Missing required parameters for [Route: generatorindex] [URI: generator/{inputkeyword}]. (View: C:\Users\Mostafa\myapp\resources\views\main.blade.php)

What am I doing wrong ? Where should I define inputkeyword parameter ?



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

Aucun commentaire:

Enregistrer un commentaire