Example #1
0
 /**
  * Handle a verify email request for the application.
  *
  * @param string $token
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
  */
 public function verifyEmail($token)
 {
     if (!($account = Verify::verifyToken($token)) instanceof Account) {
         return view('errors.emailVerifyFailed', ['message' => $account]);
     }
     $account->attachRole(Role::where('name', '=', 'verified-user')->first());
     Event::_create('events.account', $account, 'account.verifyEmail');
     return redirect()->route('home');
 }
Example #2
0
 public function download(Request $request, $examId)
 {
     if (null === $request->user()) {
         throw new AccessDeniedHttpException();
     } else {
         if (null === ($exam = Exam::find($examId))) {
             throw new NotFoundHttpException();
         }
     }
     $exam->increment('downloads');
     Event::_create('events.user', $request->user(), 'user.download', collect(['target' => 'courses.exams', 'identify' => $examId]));
     return response()->download(storage_path('uploads/courses/exams') . '/' . $exam->getAttribute('file_path'), $exam->getAttribute('file_name'), ['Content-Length' => $exam->getAttribute('file_size'), 'Content-Type' => $exam->getAttribute('file_type')]);
 }
Example #3
0
 /**
  * Handle the event.
  *
  * @param  RegisterEvent  $event
  * @return void
  */
 public function handle(RegisterEvent $event)
 {
     Event::_create('events.account', $event->account, 'account.register');
 }