Completed
Push — master ( 425779...b6e961 )
by Abdelrahman
08:30
created

UpdateLastActivity::terminate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Fort\Http\Middleware;
6
7
use Closure;
8
use Carbon\Carbon;
9
use Illuminate\Http\Request;
10
11
class UpdateLastActivity
12
{
13
    /**
14
     * Handle an incoming request.
15
     *
16
     * @param \Illuminate\Http\Request $request
17
     * @param \Closure                 $next
18
     *
19
     * @return mixed
20
     */
21
    public function handle(Request $request, Closure $next)
22
    {
23
        return $next($request);
24
    }
25
26
    /**
27
     * Perform any final actions for the request lifecycle.
28
     *
29
     * @param \Illuminate\Http\Request                   $request
30
     * @param \Symfony\Component\HttpFoundation\Response $response
31
     *
32
     * @return void
33
     */
34
    public function terminate($request, $response)
0 ignored issues
show
Unused Code introduced by
The parameter $response is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
    {
36
        $user = $request->user();
37
        $user->timestamps = false;
38
        $user->fill(['last_activity' => new Carbon()])->forceSave();
39
    }
40
}
41