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.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php namespace jlourenco\base\Models; |
||
2 | |||
3 | use Illuminate\Database\Eloquent\SoftDeletes; |
||
4 | use Cartalyst\Sentinel\Users\EloquentUser; |
||
5 | use jlourenco\support\Traits\Creation; |
||
6 | use Nicolaslopezj\Searchable\SearchableTrait; |
||
7 | |||
8 | class BaseUser extends EloquentUser |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * To allow soft deletes |
||
13 | */ |
||
14 | use SoftDeletes; |
||
15 | |||
16 | /** |
||
17 | * To allow user actions identity (Created_by, Updated_by, Deleted_by) |
||
18 | */ |
||
19 | use Creation; |
||
20 | |||
21 | /** |
||
22 | * To allow this model to be searched |
||
23 | */ |
||
24 | use SearchableTrait; |
||
25 | |||
26 | /** |
||
27 | * The database table used by the model. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $table = 'User'; |
||
32 | |||
33 | /** |
||
34 | * The attributes excluded from the model's JSON form. |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $hidden = array('password', 'remember_token'); |
||
39 | |||
40 | /** |
||
41 | * The attributes used to test the login against. |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $loginNames = ['username', 'email']; |
||
46 | |||
47 | /** |
||
48 | * {@inheritDoc} |
||
49 | */ |
||
50 | protected $fillable = [ |
||
51 | 'username', |
||
52 | 'email', |
||
53 | //'password', |
||
54 | 'last_name', |
||
55 | 'first_name', |
||
56 | 'permissions', |
||
57 | 'birthday', |
||
58 | 'status', |
||
59 | 'ip', |
||
60 | 'staff', |
||
61 | 'gender', |
||
62 | ]; |
||
63 | |||
64 | /** |
||
65 | * The attributes that aren't mass assignable. |
||
66 | * |
||
67 | * @var array |
||
68 | */ |
||
69 | protected $guarded = ['password']; |
||
70 | |||
71 | /** |
||
72 | * The attributes that will appear on the register form. |
||
73 | * |
||
74 | * @var array |
||
75 | */ |
||
76 | protected $registerFields = [ |
||
77 | 'first_name' => [ |
||
78 | 'type' => 'text', |
||
79 | 'validator' => 'required|min:3|max:25', |
||
80 | 'label' => 'First name', |
||
81 | 'placeholder' => 'You first name', |
||
82 | 'classes' => 'form-control input-lg JQMaxLength', |
||
83 | 'maxlength' => 25, |
||
84 | 'save' => true |
||
85 | ], |
||
86 | 'last_name' => [ |
||
87 | 'type' => 'text', |
||
88 | 'validator' => 'required|min:3|max:25', |
||
89 | 'label' => 'Last name', |
||
90 | 'placeholder' => 'You last name', |
||
91 | 'classes' => 'form-control input-lg JQMaxLength', |
||
92 | 'maxlength' => 25, |
||
93 | 'save' => true |
||
94 | ], |
||
95 | 'username' => [ |
||
96 | 'type' => 'text', |
||
97 | 'validator' => 'required|min:3|unique:User|max:25', |
||
98 | 'label' => 'Username', |
||
99 | 'placeholder' => 'You username', |
||
100 | 'classes' => 'form-control input-lg JQMaxLength', |
||
101 | 'maxlength' => 25, |
||
102 | 'save' => true |
||
103 | ], |
||
104 | 'email' => [ |
||
105 | 'type' => 'text', |
||
106 | 'validator' => 'required|email|unique:User,email,3,status|max:255', |
||
107 | 'label' => 'Email', |
||
108 | 'placeholder' => 'Your email', |
||
109 | 'classes' => 'form-control input-lg JQMaxLength', |
||
110 | 'maxlength' => 255, |
||
111 | 'save' => true |
||
112 | ], |
||
113 | 'email_confirm' => [ |
||
114 | 'type' => 'text', |
||
115 | 'validator' => 'required|email|same:email', |
||
116 | 'label' => 'Confirm email', |
||
117 | 'placeholder' => 'Confirm your email', |
||
118 | 'classes' => 'form-control input-lg JQMaxLength', |
||
119 | 'maxlength' => 255, |
||
120 | 'save' => false |
||
121 | ], |
||
122 | 'password' => [ |
||
123 | 'type' => 'password', |
||
124 | 'validator' => 'required|between:3,32', |
||
125 | 'label' => 'Password', |
||
126 | 'placeholder' => 'You password', |
||
127 | 'classes' => 'form-control input-lg JQMaxLength', |
||
128 | 'maxlength' => 30, |
||
129 | 'save' => true |
||
130 | ], |
||
131 | 'password_confirm' => [ |
||
132 | 'type' => 'password', |
||
133 | 'validator' => 'required|same:password', |
||
134 | 'label' => 'Confirm password', |
||
135 | 'placeholder' => 'Confirm your password', |
||
136 | 'classes' => 'form-control input-lg JQMaxLength', |
||
137 | 'maxlength' => 30, |
||
138 | 'save' => false |
||
139 | ], |
||
140 | 'birthday' => [ |
||
141 | 'type' => 'text', |
||
142 | 'validator' => 'date_format:d/m/Y|before:now', |
||
143 | 'label' => 'Birthday', |
||
144 | 'placeholder' => 'Your birthday', |
||
145 | 'classes' => 'form-control input-lg JQCalendar datepicker', |
||
146 | 'maxlength' => 10, |
||
147 | 'save' => true |
||
148 | ], |
||
149 | 'gender' => [ |
||
150 | 'type' => 'gender', |
||
151 | 'validator' => 'required|digits_between:0,2', |
||
152 | 'label' => 'Gender', |
||
153 | 'placeholder' => 'Your gender', |
||
154 | 'classes' => 'form-control', |
||
155 | 'save' => true |
||
156 | ], |
||
157 | ]; |
||
158 | |||
159 | protected $dates = ['birthday', 'last_login', 'deleted_at']; |
||
160 | |||
161 | /** |
||
162 | * The groups model name. |
||
163 | * |
||
164 | * @var string |
||
165 | */ |
||
166 | protected static $groupsModel = 'jlourenco\base\Models\Group'; |
||
167 | |||
168 | /** |
||
169 | * Searchable rules. |
||
170 | * |
||
171 | * @var array |
||
172 | */ |
||
173 | protected $searchable = [ |
||
174 | 'columns' => [ |
||
175 | 'User.first_name' => 10, |
||
176 | 'User.last_name' => 10, |
||
177 | 'BlogPost.keywords' => 5, |
||
178 | 'BlogPost.title' => 3, |
||
179 | 'BlogPost.contents' => 1, |
||
180 | ], |
||
181 | 'joins' => [ |
||
182 | 'BlogPost' => [ 'User.id', 'BlogPost.author' ], |
||
183 | ], |
||
184 | ]; |
||
185 | |||
186 | /** |
||
187 | * Scope do get all staff |
||
188 | */ |
||
189 | private function scopeStaff() |
||
190 | { |
||
191 | return $this->where('staff', 1); |
||
0 ignored issues
–
show
|
|||
192 | } |
||
193 | |||
194 | public static function getAllStaff() |
||
195 | { |
||
196 | return BaseUser::where('staff', 1) |
||
197 | ->orderBy('first_name', 'desc') |
||
198 | ->get(); |
||
199 | } |
||
200 | |||
201 | public function status() |
||
202 | { |
||
203 | switch ($this->status) { |
||
0 ignored issues
–
show
The property
status does not exist on object<jlourenco\base\Models\BaseUser> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
204 | case 0: |
||
205 | return "<span class=\"label label-warning square\">Inactive</span>"; |
||
206 | case 1: |
||
207 | return "<span class=\"label label-success square\">Active</span>"; |
||
208 | case 2: |
||
209 | return "<span class=\"label label-danger square\">Blocked</span>"; |
||
210 | case 3: |
||
211 | return "<span class=\"label label-warning square\">Inactive</span>"; |
||
212 | } |
||
213 | } |
||
214 | |||
215 | /** |
||
216 | * Returns an array of register column fields. |
||
217 | * |
||
218 | * @return array |
||
219 | */ |
||
220 | public function getRegisterFields() |
||
221 | { |
||
222 | return $this->registerFields; |
||
223 | } |
||
224 | |||
225 | /** |
||
226 | * The Groups relationship. |
||
227 | * |
||
228 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
229 | */ |
||
230 | public function groups() |
||
231 | { |
||
232 | return $this->belongsToMany(static::$groupsModel, 'Group_User', 'user', 'group')->withTimestamps(); |
||
233 | } |
||
234 | |||
235 | /** |
||
236 | * Returns the roles relationship. |
||
237 | * |
||
238 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
239 | */ |
||
240 | public function roles() |
||
241 | { |
||
242 | return $this->belongsToMany(static::$rolesModel, 'Group_User', 'user', 'group')->withTimestamps(); |
||
243 | } |
||
244 | |||
245 | /** |
||
246 | * Returns the groups model. |
||
247 | * |
||
248 | * @return string |
||
249 | */ |
||
250 | public static function getGroupsModel() |
||
251 | { |
||
252 | return static::$groupsModel; |
||
253 | } |
||
254 | |||
255 | /** |
||
256 | * Sets the groups model. |
||
257 | * |
||
258 | * @param string $groupsModel |
||
259 | * @return void |
||
260 | */ |
||
261 | public static function setGroupsModel($groupsModel) |
||
262 | { |
||
263 | static::$groupsModel = $groupsModel; |
||
264 | } |
||
265 | |||
266 | } |
||
267 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: