public function store(Request $request)
{
// this code for validation
// this code for creating student record
if($request->secondName=='prabhu')
{
$student = new Student();
$student->Roll_Num = $request->input('Roll_Num');
$student->firstName = $request->input('firstName');
$student->secondName = $request->input('secondName');
$student->age = $request->input('age');
$student->speciality = $request->input('speciality');
$student->save();
return redirect('/inde');
}
elseif($request->firstName=='Ram')
{
$employee = new Employee();
$employee->firstName = $request->input('firstName');
$employee->secondName = $request->input('secondName');
$employee->age = $request->input('age');
$employee->speciality = $request->input('speciality');
$employee->save();
return redirect('/inde');
}
elseif($request->firstName=='Shyam')
{
$teacher = new Teacher();
$teacher ->firstName = $request->input('firstName');
$teacher ->secondName = $request->input('secondName');
$teacher ->speciality = $request->input('speciality');
$teacher ->save();
return redirect('/inde');
}
}
0 Comments