コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
ファイル: Submission.php プロジェクト: YounessTayer/respond
 /**
  * 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;
 }