Last change
on this file since f457265 was 0924b6c, checked in by Özkan İliyaz <iliyaz_96@…>, 4 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
686 bytes
|
Rev | Line | |
---|
[0924b6c] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace App\Http\Middleware;
|
---|
| 4 |
|
---|
| 5 | use Closure;
|
---|
| 6 | use App\Models\User;
|
---|
| 7 |
|
---|
| 8 | class 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.