1
|
|
|
<?php namespace crocodicstudio\crudbooster\controllers; |
2
|
|
|
|
3
|
|
|
use Illuminate\Support\Facades\Excel; |
|
|
|
|
4
|
|
|
use Illuminate\Support\Facades\PDF; |
|
|
|
|
5
|
|
|
|
6
|
|
|
class LogsController extends CBController |
7
|
|
|
{ |
8
|
|
|
public function cbInit() |
9
|
|
|
{ |
10
|
|
|
$this->table = 'cms_logs'; |
11
|
|
|
$this->primary_key = 'id'; |
12
|
|
|
$this->title_field = "ipaddress"; |
13
|
|
|
$this->button_bulk_action = true; |
14
|
|
|
$this->button_export = false; |
15
|
|
|
$this->button_import = false; |
16
|
|
|
$this->button_add = false; |
17
|
|
|
$this->button_edit = false; |
18
|
|
|
$this->button_delete = true; |
19
|
|
|
|
20
|
|
|
$this->col = []; |
21
|
|
|
$this->col[] = ["label" => "Time Access", "name" => "created_at"]; |
22
|
|
|
$this->col[] = ["label" => "IP Address", "name" => "ipaddress"]; |
23
|
|
|
$this->col[] = ["label" => "User", "name" => "id_cms_users", "join" => config('crudbooster.USER_TABLE').",name"]; |
24
|
|
|
$this->col[] = ["label" => "Description", "name" => "description"]; |
25
|
|
|
|
26
|
|
|
$this->form = []; |
27
|
|
|
$this->form[] = ["label" => "Time Access", "name" => "created_at", "readonly" => true]; |
28
|
|
|
$this->form[] = ["label" => "IP Address", "name" => "ipaddress", "readonly" => true]; |
29
|
|
|
$this->form[] = ["label" => "User Agent", "name" => "useragent", "readonly" => true]; |
30
|
|
|
$this->form[] = ["label" => "URL", "name" => "url", "readonly" => true]; |
31
|
|
|
$this->form[] = [ |
32
|
|
|
"label" => "User", |
33
|
|
|
"name" => "id_cms_users", |
34
|
|
|
"type" => "select", |
35
|
|
|
"datatable" => config('crudbooster.USER_TABLE').",name", |
36
|
|
|
"readonly" => true, |
37
|
|
|
]; |
38
|
|
|
$this->form[] = ["label" => "Description", "name" => "description", "readonly" => true]; |
39
|
|
|
$this->form[] = ["label" => "Details", "name" => "details", "type" => "custom"]; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public static function displayDiff($old_values, $new_values) |
43
|
|
|
{ |
44
|
|
|
$diff = self::getDiff($old_values, $new_values); |
45
|
|
|
$table = '<table class="table table-striped"><thead><tr><th>Key</th><th>Old Value</th><th>New Value</th></thead><tbody>'; |
46
|
|
|
foreach ($diff as $key => $value) { |
47
|
|
|
$table .= "<tr><td>$key</td><td>$old_values[$key]</td><td>$new_values[$key]</td></tr>"; |
48
|
|
|
} |
49
|
|
|
$table .= '</tbody></table>'; |
50
|
|
|
|
51
|
|
|
return $table; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
private static function getDiff($old_values, $new_values) |
55
|
|
|
{ |
56
|
|
|
unset($old_values['id']); |
57
|
|
|
unset($old_values['created_at']); |
58
|
|
|
unset($old_values['updated_at']); |
59
|
|
|
unset($new_values['created_at']); |
60
|
|
|
unset($new_values['updated_at']); |
61
|
|
|
|
62
|
|
|
return array_diff($old_values, $new_values); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths