This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||
2 | |||
3 | namespace App; |
||
4 | |||
5 | use Illuminate\Notifications\Notifiable; |
||
6 | use Illuminate\Foundation\Auth\User as Authenticatable; |
||
7 | use Illuminate\Database\Eloquent\SoftDeletes; |
||
8 | use Spatie\Activitylog\Traits\LogsActivity; |
||
9 | use Illuminate\Support\Facades\Auth; |
||
10 | |||
11 | class User extends Authenticatable |
||
12 | { |
||
13 | use Notifiable; |
||
14 | use SoftDeletes; |
||
15 | use LogsActivity; |
||
16 | |||
17 | /** |
||
18 | * The attributes that should be mutated to dates. |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $dates = [ |
||
23 | 'deleted_at' |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * The attributes that are mass assignable. |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $fillable = [ |
||
32 | 'name', 'email', 'password', 'role', 'phone', 'preferred_device_id' |
||
33 | ]; |
||
34 | |||
35 | /** |
||
36 | * The attributes to ignore in the Activity Log |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | protected static $ignoreChangedAttributes = [ |
||
41 | 'updated_at', 'remember_token' |
||
42 | ]; |
||
43 | |||
44 | /** |
||
45 | * The attributes to log in the Activity Log |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected static $logAttributes = [ |
||
50 | 'name', 'email', 'password', 'role', 'phone', 'preferred_device_id' |
||
51 | ]; |
||
52 | |||
53 | /** |
||
54 | * Only log those that have actually changed after the update. |
||
55 | * |
||
56 | * @var array |
||
57 | */ |
||
58 | protected static $logOnlyDirty = true; |
||
59 | |||
60 | /** |
||
61 | * The attributes that should be hidden for arrays. |
||
62 | * |
||
63 | * @var array |
||
64 | */ |
||
65 | protected $hidden = [ |
||
66 | 'password', 'remember_token', |
||
67 | ]; |
||
68 | |||
69 | /** |
||
70 | * Update the updated_at and created_at timestamps? |
||
71 | * |
||
72 | * @var array |
||
73 | */ |
||
74 | public $timestamps = true; |
||
75 | |||
76 | /** |
||
77 | * Route notifications for the Nexmo channel. |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | public function routeNotificationForNexmo() |
||
82 | { |
||
83 | return $this->phone; |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * Is user Admin or better? |
||
88 | * |
||
89 | * @return boolean |
||
90 | */ |
||
91 | public function isAdmin() |
||
92 | { |
||
93 | return $this->role > 2; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * Is user Manager or better? |
||
98 | * |
||
99 | * @return boolean |
||
100 | */ |
||
101 | public function isManager() |
||
102 | { |
||
103 | return $this->role > 1; |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * Is user User or better? |
||
108 | * |
||
109 | * @return boolean |
||
110 | */ |
||
111 | public function isUser() |
||
112 | { |
||
113 | return $this->role > 0; |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * Is user a guest? |
||
118 | * |
||
119 | * @return boolean |
||
120 | */ |
||
121 | public function isGuest() |
||
122 | { |
||
123 | return $this->role == 0; |
||
124 | } |
||
125 | |||
126 | |||
127 | /** |
||
128 | * Returns a list of managers. |
||
129 | * |
||
130 | * @return Users |
||
0 ignored issues
–
show
|
|||
131 | */ |
||
132 | public function managers() |
||
133 | { |
||
134 | return $this->where('role', '>', 1)->get(); |
||
0 ignored issues
–
show
|
|||
135 | } |
||
136 | |||
137 | /** |
||
138 | * Returns the users role as a string. |
||
139 | * |
||
140 | * @return string |
||
141 | */ |
||
142 | public function roleString() |
||
143 | { |
||
144 | $role_en = array(0 => "Registered", 1 => "User", 2 => "Manager", 3 => "Admin"); |
||
145 | return $role_en[ $this->role ].' ('.$this->role.')'; |
||
146 | } |
||
147 | |||
148 | /** |
||
149 | * Get the preferred device of the user |
||
150 | */ |
||
151 | public function preferredDevice() |
||
152 | { |
||
153 | return $this->hasOne('App\Device', 'id', 'preferred_device_id'); |
||
154 | } |
||
155 | |||
156 | /** |
||
157 | * Accessor: Get the user's last update time in seconds/minutes/hours since update or converted to user |
||
158 | * friendly readable format. |
||
159 | * If the time is less then a day old then display time since it last updated |
||
160 | * If the time is greater then a day old then display the time in the format of Month day, year 12hour:mins am/pm |
||
161 | * and using the user's preferred timezone |
||
162 | * |
||
163 | * |
||
164 | * @return string |
||
165 | */ |
||
166 | View Code Duplication | public function getUpdatedAtHumanAttribute() |
|
167 | { |
||
168 | if ($this->updated_at->diffInDays() > 0) { |
||
169 | return $this->updated_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a'); |
||
170 | } else { |
||
171 | return $this->updated_at->diffForHumans(); |
||
172 | } |
||
173 | } |
||
174 | |||
175 | /** |
||
176 | * Accessor: Get the user's creation time in seconds/minutes/hours since update or converted to user |
||
177 | * friendly readable format. |
||
178 | * If the time is less then a day old then display time since creation |
||
179 | * If the time is greater then a day old then display the time in the format of Month day, year 12hour:mins am/pm |
||
180 | * and using the user's preferred timezone |
||
181 | * |
||
182 | * |
||
183 | * @return string |
||
184 | */ |
||
185 | View Code Duplication | public function getCreatedAtHumanAttribute() |
|
186 | { |
||
187 | if ($this->created_at->diffInDays() > 0) { |
||
188 | return $this->created_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a'); |
||
189 | } else { |
||
190 | return $this->created_at->diffForHumans(); |
||
191 | } |
||
192 | } |
||
193 | |||
194 | /** |
||
195 | * Accessor: Get the user's deletion time in seconds/minutes/hours since deletion or converted to user |
||
196 | * friendly readable format. |
||
197 | * If the time is less then a day old then display time since deletion |
||
198 | * If the time is greater then a day old then display the time in the format of Month day, year 12hour:mins am/pm |
||
199 | * and using the user's preferred timezone |
||
200 | * |
||
201 | * |
||
202 | * @return string |
||
203 | */ |
||
204 | View Code Duplication | public function getDeletedAtHumanAttribute() |
|
205 | { |
||
206 | if ($this->deleted_at->diffInDays() > 0) { |
||
207 | return $this->deleted_at->setTimezone(Auth::user()->timezone)->format('M d, Y h:i a'); |
||
208 | } else { |
||
209 | return $this->deleted_at->diffForHumans(); |
||
210 | } |
||
211 | } |
||
212 | } |
||
213 |
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