/** * Store a newly created resource in storage. * * @return Response */ public function store(AdmissionRequest $request) { $filename = $request->get("fileName"); $src = 'fileStorage/temp/' . $filename; $des = 'fileStorage/persons/' . $request->get('name') . '.jpg'; rename($src, $des); $student = array_except($request->all(), array('fileName')); $student['image'] = $des; Admission::create($student); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(AdmissionRequest $request) { $input = $request->all(); $input['photo'] = 'fileStorage/' . $_FILES['photo']['name']; move_uploaded_file($_FILES['photo']['tmp_name'], $input['photo']); $admission = Admission::create($input); $info['exam'] = $input['exam']; $info['board'] = $input['board']; $info['roll'] = $input['roll']; $info['year'] = $input['year']; $info['gpa'] = $input['gpa']; $info['admission_id'] = $admission->id; Academicinfotemp::create($info); return "Saved!"; }