1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Sfneal\Tracking\Controllers; |
4
|
|
|
|
5
|
|
|
use Domain\Users\Models\User; |
|
|
|
|
6
|
|
|
use Illuminate\Contracts\View\Factory; |
7
|
|
|
use Illuminate\Http\Request; |
8
|
|
|
use Illuminate\View\View; |
9
|
|
|
use Sfneal\Controllers\AbstractController; |
10
|
|
|
use Sfneal\Helpers\Time\TimePeriods; |
11
|
|
|
use Sfneal\Tracking\Queries\TrackActionQuery; |
12
|
|
|
use Sfneal\Tracking\Queries\TrackActivityQuery; |
13
|
|
|
|
14
|
|
|
class TrackingController extends AbstractController |
15
|
|
|
{ |
16
|
|
|
// todo: add to config |
17
|
|
|
/** |
18
|
|
|
* Routes & views prefix. |
19
|
|
|
*/ |
20
|
|
|
private const PREFIX = 'support.tracking'; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Tables with viewable activity. |
24
|
|
|
*/ |
25
|
|
|
private const TABLES = ['plan', 'project', 'task']; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Create a new controller instance. |
29
|
|
|
* |
30
|
|
|
* @return void |
31
|
|
|
*/ |
32
|
|
|
public function __construct() |
33
|
|
|
{ |
34
|
|
|
$this->middleware('auth'); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Display the Activity Tracking dashboard. |
39
|
|
|
* |
40
|
|
|
* @param Request $request |
41
|
|
|
* @return array|Factory|View|mixed |
42
|
|
|
*/ |
43
|
|
|
public function index(Request $request) |
44
|
|
|
{ |
45
|
|
|
// todo: add 'users' to config |
46
|
|
|
return view(self::PREFIX.'.index', [ |
47
|
|
|
'title' => 'Activity Tracking', |
48
|
|
|
'tables' => self::TABLES, |
49
|
|
|
'users' => User::all(), |
50
|
|
|
'times' => TimePeriods::get('today', 'yesterday', 'thisWeek', 'thisMonth'), |
51
|
|
|
]); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Display a table of activity in particular tables. |
56
|
|
|
* |
57
|
|
|
* @param Request $request |
58
|
|
|
* @return array|Factory|View|mixed |
59
|
|
|
*/ |
60
|
|
|
public function show(Request $request) |
61
|
|
|
{ |
62
|
|
|
return view(self::PREFIX.'.show', [ |
63
|
|
|
'title' => ucwords($request->input('title')), |
64
|
|
|
]); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Display table of activity history for all Plans. |
69
|
|
|
* |
70
|
|
|
* @param Request $request |
71
|
|
|
* @return array|Factory|View|mixed |
72
|
|
|
*/ |
73
|
|
|
public function activity(Request $request) |
74
|
|
|
{ |
75
|
|
|
return view(self::PREFIX.'.activity.results', [ |
76
|
|
|
// Retrieve Collection of Activities |
77
|
|
|
'activities' => TrackActivityQuery::execute($request)->get(), |
78
|
|
|
|
79
|
|
|
// Don't show plan_ids if a model_key has been specified |
80
|
|
|
'hide_id' => $request->has('key'), |
81
|
|
|
|
82
|
|
|
// Don't show user ID's if a user_id has been specified |
83
|
|
|
'hide_user' => $request->has('user') || $request->has('users'), |
84
|
|
|
]); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Display table of action history for all Plans. |
89
|
|
|
* |
90
|
|
|
* @param Request $request |
91
|
|
|
* @return array|Factory|View|mixed |
92
|
|
|
*/ |
93
|
|
|
public function action(Request $request) |
94
|
|
|
{ |
95
|
|
|
return view(self::PREFIX.'.actions.results', [ |
96
|
|
|
// Retrieve Collection of Actions |
97
|
|
|
'actions' => TrackActionQuery::execute($request)->get(), |
98
|
|
|
|
99
|
|
|
// Don't show plan_ids if a model_key has been specified |
100
|
|
|
'hide_id' => $request->has('key'), |
101
|
|
|
]); |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|
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