public function addProblems(Request $request) { $pdf = $request->file('pdf'); $entrada = $request->file('entrada'); $salida = $request->file('salida'); $random = rand(1, 100000); $pdf->move('files', $random . $pdf->getClientOriginalName()); $entrada->move('files', $random . $entrada->getClientOriginalName()); $salida->move('files', $random . $salida->getClientOriginalName()); $problema = new Problem(array('nombre' => $request->input('nombre'), 'memoria' => $request->input('memoria'), 'tiempo' => $request->input('tiempo'), 'pdf' => $random . $pdf->getClientOriginalName(), 'in' => $random . $entrada->getClientOriginalName(), 'out' => $random . $salida->getClientOriginalName(), 'categoria' => $request->input('categoria'))); $problema->save(); return redirect('admin/problem'); }
/** * save needy form records into database * return redirect to same page */ public function save(Request $request) { $problem = new Problem(); $problem->name = ucwords($request->input('name')); $problem->phone = $request->input('phone'); $problem->address = $request->input('address'); $problem->problem = $request->input('problem'); $problem->severity = $request->input('severity'); $problem->cost = $request->input('cost'); $problem->userId = Auth::user()->id; $problem->save(); //else record wont be saved return back()->with('status', 'Your Problem has been submitted. Please be patience while a Donner volunteer to help you. Thanks'); }