redirect To NextTask Page after Submitting Form

Posted 7 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.

Reply to

Use Markdown with GitHub-flavored code blocks.