-
-
Notifications
You must be signed in to change notification settings - Fork 364
/
LogActivity.php
37 lines (32 loc) · 952 Bytes
/
LogActivity.php
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
30
31
32
33
34
35
36
37
<?php
/**
* NOTICE OF LICENSE
*
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D
* @license https://choosealicense.com/licenses/gpl-3.0/ GNU General Public License v3.0
* @author HDVinnie
*/
namespace App\Helpers;
use Request;
use App\LogActivity as LogActivityModel;
class LogActivity
{
public static function addToLog($subject)
{
$log = [];
$log['subject'] = $subject;
$log['url'] = Request::fullUrl();
$log['method'] = Request::method();
$log['ip'] = Request::ip();
$log['agent'] = Request::header('user-agent');
$log['user_id'] = auth()->check() ? auth()->user()->id : 0;
LogActivityModel::create($log);
}
public static function logActivityLists()
{
return LogActivityModel::latest()->paginate(50);
}
}