我希望我的表单在用户提交任务后重定向到$ NExtTask,我在没有控制器的情况下尝试了它,但是它转到了URL,但没有加载网站并使用控件获得了错误的URL提示?
我的控制器
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 ');
}
我的路线
Route::get('category/{category}/{path}/mid-senior/{task}', 'CollegeController@TakeTask');
Route::post('category/{category}/{path}/mid-senior/{task}', 'CollegeController@subPost');
我的表格
<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>