LogController.php 807 Bytes
Newer Older
Dominik Hebeler's avatar
Dominik Hebeler committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Redis;

class LogController extends Controller
{
    function clicklog(Request $request) 
    {
        $redis = Redis::connection('redisLogs');
        if( $redis )
        {
            $logEntry = "";
            $logEntry .= "[" . date(DATE_RFC822, mktime(date("H"),date("i"), date("s"), date("m"), date("d"), date("Y"))) . "]";
            $logEntry .= "  " . $request->input('i');
            $logEntry .= "  " . $request->input('s');
            $logEntry .= "  " . $request->input('q');
            $logEntry .= "  " . $request->input('p');
            $logEntry .= "  " . $request->input('url');

            $redis->rpush('logs.clicks', $logEntry);
        }
        return '';
    } 

}