/** * Removes a submission * * @return Response */ public function remove(Request $request) { // get request data $siteId = $request->input('auth-id'); // get id of submission $id = $request->json()->get('id'); $submission = Submission::getById($id, $siteId); $submission->remove($siteId); // return OK return response('OK, submission removed at = ' . $submission->id, 200); }
/** * Saves a submission * * @param {string} $id the ID of the site * @return {Site} */ public function save($siteId) { // defaults $dir = app()->basePath() . '/resources/sites/' . $siteId . '/'; $is_match = false; $submissions = Submission::listAll($siteId); // push user array_push($submissions, (array) $this); // save users $json = json_encode($submissions, JSON_PRETTY_PRINT); // save site.json Utilities::saveContent($dir, 'submissions.json', $json); return; }