Esempio n. 1
0
 /**
  * Verify if code exists and if he's valid
  * POST
  *
  * @param Code $codeLib
  * @param Request $request
  * @return Response
  */
 public function verifyCode(Code $codeLib, Request $request)
 {
     $this->validate($request, ['code' => 'required|alpha_num|exists:cms_codes,key']);
     $code = CodeManager::find($request->code);
     if ($codeLib->have($code->accounts, Auth::user()->guid)) {
         return redirect()->route('gift.code');
     }
     return redirect()->route('gift.validate', ['code' => $request->code]);
 }
Esempio n. 2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $codeLib = new Code();
     $key = $request->route('key');
     $code = \App\Model\Code::find($key);
     if ($codeLib->have($code->accounts, \Auth::user()->guid)) {
         return abort(404);
     }
     return $next($request);
 }