/** * Store a newly created resource in storage. * * @return Response */ public function postStore(Request $request) { $input = $request->all(); // return ($input['Administrative']); DB::beginTransaction(); $apps = Application::create($input['REGISTRANT']); $input['Administrative']['registrant_id'] = $apps->id; $input['Technical']['registrant_id'] = $apps->id; if ($request->hasFile("image1")) { $destinationPath = 'uploads/a/'; $fileName = time() . "-" . $request->file('image1')->getClientOriginalName(); $request->file('image1')->move($destinationPath, $fileName); $input['Administrative']['image'] = $fileName; } if ($request->hasFile('image2')) { $destinationPath = 'uploads/t/'; $fileName = time() . "-" . $request->file('image2')->getClientOriginalName(); $request->file('image2')->move($destinationPath, $fileName); $input['Technical']['image'] = $fileName; } return 1; Administrative::create($input['Administrative']); Technical::create($input['Technical']); DB::commit(); return redirect()->back()->withSuccess('Application Submitted Successfully'); }
public function getDeleteApplication($id) { DB::beginTransaction(); Application::where('id', $id)->delete(); Administrative::where('registrant_id', $id)->delete(); Technical::where('registrant_id', $id)->delete(); DB::commit(); }