1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace jeremykenedy\LaravelLogger\App\Models; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
|
|
|
6
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes; |
|
|
|
|
7
|
|
|
|
8
|
|
|
class Activity extends Model |
9
|
|
|
{ |
10
|
|
|
use SoftDeletes; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* The table associated with the model. |
14
|
|
|
* |
15
|
|
|
* @var string |
16
|
|
|
*/ |
17
|
|
|
protected $table; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* The connection name for the model. |
21
|
|
|
* |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
protected $connection; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Indicates if the model should be timestamped. |
28
|
|
|
* |
29
|
|
|
* @var bool |
30
|
|
|
*/ |
31
|
|
|
public $timestamps = true; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* The attributes that are not mass assignable. |
35
|
|
|
* |
36
|
|
|
* @var array |
37
|
|
|
*/ |
38
|
|
|
protected $guarded = [ |
39
|
|
|
'id', |
40
|
|
|
]; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* The attributes that should be mutated to dates. |
44
|
|
|
* |
45
|
|
|
* @var array |
46
|
|
|
*/ |
47
|
|
|
protected $dates = [ |
48
|
|
|
'created_at', |
49
|
|
|
'updated_at', |
50
|
|
|
'deleted_at', |
51
|
|
|
]; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Fillable fields for a Profile. |
55
|
|
|
* |
56
|
|
|
* @var array |
57
|
|
|
*/ |
58
|
|
|
protected $fillable = [ |
59
|
|
|
'description', |
60
|
|
|
'userType', |
61
|
|
|
'userId', |
62
|
|
|
'route', |
63
|
|
|
'ipAddress', |
64
|
|
|
'userAgent', |
65
|
|
|
'locale', |
66
|
|
|
'referer', |
67
|
|
|
'methodType', |
68
|
|
|
]; |
69
|
|
|
|
70
|
|
|
protected $casts = [ |
71
|
|
|
'description' => 'string', |
72
|
|
|
'user' => 'integer', |
73
|
|
|
'route' => 'string', |
74
|
|
|
'ipAddress' => 'ipAddress', |
75
|
|
|
'userAgent' => 'string', |
76
|
|
|
'locale' => 'string', |
77
|
|
|
'referer' => 'string', |
78
|
|
|
'methodType' => 'string', |
79
|
|
|
]; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Create a new instance to set the table and connection. |
83
|
|
|
* |
84
|
|
|
* @return void |
85
|
|
|
*/ |
86
|
|
|
public function __construct($attributes = []) |
87
|
|
|
{ |
88
|
|
|
parent::__construct($attributes); |
89
|
|
|
$this->table = config('LaravelLogger.loggerDatabaseTable'); |
|
|
|
|
90
|
|
|
$this->connection = config('LaravelLogger.loggerDatabaseConnection'); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* Get the database connection. |
95
|
|
|
*/ |
96
|
|
|
public function getConnectionName() |
97
|
|
|
{ |
98
|
|
|
return $this->connection; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Get the database connection. |
103
|
|
|
*/ |
104
|
|
|
public function getTableName() |
105
|
|
|
{ |
106
|
|
|
return $this->table; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* An activity has a user. |
111
|
|
|
* |
112
|
|
|
* @var array |
113
|
|
|
*/ |
114
|
|
|
public function user() |
115
|
|
|
{ |
116
|
|
|
return $this->hasOne(config('LaravelLogger.defaultUserModel')); |
|
|
|
|
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Get a validator for an incoming Request. |
121
|
|
|
* |
122
|
|
|
* @param array $merge (rules to optionally merge) |
123
|
|
|
* |
124
|
|
|
* @return array |
125
|
|
|
*/ |
126
|
|
|
public static function rules($merge = []) |
127
|
|
|
{ |
128
|
|
|
return array_merge( |
129
|
|
|
[ |
130
|
|
|
'description' => 'required|string', |
131
|
|
|
'userType' => 'required|string', |
132
|
|
|
'userId' => 'nullable|integer', |
133
|
|
|
'route' => 'nullable|url', |
134
|
|
|
'ipAddress' => 'nullable|ip', |
135
|
|
|
'userAgent' => 'nullable|string', |
136
|
|
|
'locale' => 'nullable|string', |
137
|
|
|
'referer' => 'nullable|string', |
138
|
|
|
'methodType' => 'nullable|string', |
139
|
|
|
], |
140
|
|
|
$merge |
141
|
|
|
); |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* User Agent Parsing Helper |
146
|
|
|
* |
147
|
|
|
* @return String |
148
|
|
|
*/ |
149
|
|
|
public function getUserAgentDetailsAttribute() |
150
|
|
|
{ |
151
|
|
|
return \jeremykenedy\LaravelLogger\App\Http\Traits\UserAgentDetails::details($this->userAgent); |
|
|
|
|
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
} |
155
|
|
|
|
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