I have 3 tab menus and one of them contains a form for processing some data. I did some some Javascript manipulations that allows the controller return data to that specific page after processing the form. The problem now is that the data is not that of POST method (i.e. the processed data) but of the GET (i.e. default data).
This is my controller
public function index(Request $request){
$method = $request->isMethod('post');
if($method){
$members = $projects = "some data";
return redirect()->route('progress_reports')->with(['projects' => $projects, 'members' => $members])->withInput(['tab'=>'progress_report']);;
}else{
$projects = $members = "default data";
$results = Project::all();
return view('reports.index', compact('projects', 'members', 'results'));
}
}
My View
<ul class="nav nav-tabs" id="tabMenu">
<li class="active"><a href="#tab1info" data-toggle="tab">Activity Log</a></li>
<li><a href="#progress_report" data-toggle="tab">Progress Report</a></li>
<li><a href="#tab3info" data-toggle="tab">Find By</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="tab1info">Info 1</div>
<div class="tab-pane fade" id="progress_report">
@include('reports.partials.progress_report')
</div>
<div class="tab-pane fade" id="tab3info">
@include('reports.partials.find_by')
</div>
</div>
JS file:
$('#tabMenu a[href="#"]').tab('show');
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire