i am trying to open different views, based upon request value.
for example if $request value is set to 1 then view 1 should open. if $request value is 2 then view 2 should open.
my code is working fine but right now i will have to repeat code for each view, how can i do it without repeating ****if**** condition..
Scenario:
public function printreports(Request $request)
{
$reports=$request->get('reports');
if($reports==1) {
return view('teachers.report1',compact('anything'));
}
if($reports==2) {
return view('teachers.report2',compact('anything'));
}}
.
.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire