redirect To NextTask Page after Submitting Form

Posted 2 months ago by Kareimovich

I Want My Form to redirect To $NExtTask after user submit Task I tried it without the controller but it goes to the URL but not loading the site and using control getting the wrong URL any ideas?

My Controller

public function subPost(ProgrammingField $category, Path $Path,Task $task){

    $enrollee = Enrollee::where('path_id',1)->where('user_id',Auth::user()->id)->first();

    Enrollee::where('path_id',1 )->where('user_id',Auth::user()->id )->update([
        'user_id'  => auth()->user()->id,
        'task_id'  => $enrollee->task_id.','.request('Task_id')
    ]);

return redirect( 'category/'.'.$Tasks->ProgrammingField->slug.'/'.$Tasks->slug.'/'.Request::segment(4).'/'.$NextTask  ');

}

My Route

     Route::get('category/{category}/{path}/mid-senior/{task}', '[email protected]');

     Route::post('category/{category}/{path}/mid-senior/{task}', '[email protected]');

My Form

   <form method="POST"
  action="{{ url('category/'.$Tasks->ProgrammingField->slug.'/'.$Tasks->slug.'/'.Request::segment(4).'/'.$NextTask ) }}">
    @csrf

    <div class="form-group">
            <input  type="hidden" class="form-control"  name="Task_id" value="{{$itask->id}}">
            <input  type="hidden" class="form-control"  name="Next_id" value="{{$NextTask}}">

        </div>
 <button type="submit" class="btn btn-success">Submit & Continue</button>

</form>

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.