public static function createFromRequest(SubmitSolutionRequest $request, Problem $problem, Contest $contest = null) { assert(Auth::check()); assert($request->isFileFieldOK('source')); $source = $request->popSourceInfo(); $verdict = $problem->getSubmissionVerdict($source['content'], $source['ext']); $data = ['user_id' => Auth::user()->id, 'contest_id' => !is_null($contest) ? $contest->id : null, 'problem_id' => $problem->id, 'source' => $source['content'], 'source_kind' => $source['ext'], 'verdict' => $verdict]; return Submission::create($data); }
public function submit($problem_id, Requests\SubmitSolutionRequest $request) { if (!$request->isFileFieldOK('source')) { abort(409, 'No se completó el envío del archivo al servidor.'); } $problem = Problem::findOrFail($problem_id); Submission::createFromRequest($request, $problem); return redirect(action('UsersController@submissions', Auth::user()->id)); }
/** * 솔루션 생성 * * @param array $request * @return App\Models\Solution */ public function createSolution(array $request) { if (Problem::findOrFail($request['problem_id'])->status != Problem::openCode) { abort(404); } $code = $request['code']; $request['user_id'] = $this->user->id; $request = array_only($request, Solution::$editable); $request = array_add($request, 'code', $code); return $this->service->createSolution($request); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $types = Problem::lists('problem_types', 'problem_types'); $area = Area::lists('area', 'area'); $complaint = Complaint::findOrFail($id); $disable = 1; return view('complaints.edit', compact('complaint', 'types', 'area', 'disable')); }
public function create($problem_id) { $problem = Problem::findOrFail($problem_id); return view('problems.testcases.create', compact('problem')); }