1 | <?php |
||
2 | |||
3 | namespace Devpri\Tinre\Http\Controllers; |
||
4 | |||
5 | use Carbon\Carbon; |
||
6 | use Devpri\Tinre\Jobs\ProcessClick; |
||
7 | use Devpri\Tinre\Models\Url; |
||
8 | use Illuminate\Http\Request; |
||
9 | |||
10 | class RedirectController extends Controller |
||
11 | { |
||
12 | 2 | public function redirect(Request $request, $path) |
|
0 ignored issues
–
show
|
|||
13 | { |
||
14 | 2 | $path = strtolower($request->path); |
|
15 | |||
16 | 2 | $url = Url::whereRaw('lower(path) = (?)', [$path])->where(['active' => 1])->first(); |
|
17 | |||
18 | 2 | if (! $url) { |
|
19 | 1 | return redirect('/'); |
|
20 | } |
||
21 | |||
22 | 1 | $userAgent = $request->header('User-Agent'); |
|
23 | 1 | $ip = $request->ip; |
|
24 | 1 | $createdAt = Carbon::now(); |
|
25 | 1 | $referer = $request->server('HTTP_REFERER'); |
|
26 | |||
27 | 1 | ProcessClick::dispatch($url, $createdAt, $ip, $userAgent, $referer); |
|
28 | |||
29 | 1 | return redirect($url->long_url, config('tinre.redirect_type', 302)); |
|
30 | } |
||
31 | } |
||
32 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.