samedi 10 février 2018

Laravel Route Redirect with URL Parameter

I am trying to generate a unique id and then redirect to a different route with id in the url parameter. But I am getting error as :

"Route [sequences] not defined."

Here is my route defined:

Route::get('/sequences_create','SequencesController@create');
Route::get('/sequences/{id}', 'SequencesController@show');

Here is the create function on the sequences controller:

public function create()
    {
        $uniq = 'seq'. uniqid();
        $seq = new Sequences;
        $seq->id = $uniq;
        $seq->user_id = auth()->user()->id;
        $seq->name = 'New Sequence'; //temp name
        $seq->save();
        return redirect()->route('sequences', ['id' => $uniq]);
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire