source: app/Http/Middleware/CheckVerifyNewEmail.php

Last change on this file was 0924b6c, checked in by Özkan İliyaz <iliyaz_96@…>, 4 years ago

initial commit

  • Property mode set to 100644
File size: 686 bytes
RevLine 
[0924b6c]1<?php
2
3namespace App\Http\Middleware;
4
5use Closure;
6use App\Models\User;
7
8class CheckVerifyNewEmail
9{
10 /**
11 * Handle an incoming request.
12 *
13 * @param \Illuminate\Http\Request $request
14 * @param \Closure $next
15 * @return mixed
16 */
17 public function handle($request, Closure $next)
18 {
19 $id = $request->route("id");
20 $token = $request->route("token");
21
22 $user = User::findOrFail($id);
23
24 if($user->is_active) {
25 return redirect()->route("auth.loginShow");
26 }
27
28 if($user->verify_token != $token) {
29 return redirect()->route("blog.index");
30 }
31
32 return $next($request);
33 }
34}
Note: See TracBrowser for help on using the repository browser.