コード例 #1
0
 public function handle()
 {
     $data = \Request::only(['device', 'tag', 'service']);
     try {
         $keyFob = $this->keyFobAccess->lookupKeyFob($data['tag']);
     } catch (\Exception $e) {
         \Log::debug(json_encode($data));
         return \Response::make('Not found', 404);
     }
     $user = $keyFob->user()->first();
     $this->paymentRepository->recordPayment($data['service'], $user->id, 'balance', null, 0.05, 'paid', 0, $data['device']);
     event(new MemberActivity($keyFob, $data['service']));
     return \Response::make('OK', 201);
 }
コード例 #2
0
 private function returnMemberStatus($data)
 {
     try {
         $user = $this->keyFobAccess->verifyForEntry($data['tag'], 'main-door', $data['time']);
     } catch (\Exception $e) {
         $responseData = ['valid' => '0', 'cmd' => ''];
         return $this->sendResponse($responseData);
     }
     $responseData = ['member' => $this->keyFobAccess->getMemberName(), 'valid' => '1', 'cmd' => ''];
     return $this->sendResponse($responseData);
 }
コード例 #3
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  *
  * @SWG\Delete(
  *     path="/acs/activity/{activityId}",
  *     tags={"activity"},
  *     description="End a period of an activity",
  *     @SWG\Parameter(name="activityId", in="path", type="string", required=true),
  *     @SWG\Response(response="204", description="Activity ended/deleted"),
  *     @SWG\Response(response="400", description="Session invalid"),
  *     security={{"api_key": {}}}
  * )
  */
 public function destroy(Request $request, $activityId)
 {
     $keyFob = $this->fobAccess->extendedKeyFobLookup($request->get('tagId'));
     $this->equipmentLogRepository->endSession($activityId);
     return response()->json([], 204);
 }