johnnymast /
myio
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 |
||
| 2 | |||
| 3 | namespace App\Http\Controllers\Admin; |
||
| 4 | |||
| 5 | use App\Http\Controllers\Controller; |
||
| 6 | use App\Http\Requests\Admin\UserRequest; |
||
| 7 | use App\Notifications\EmailVerification; |
||
| 8 | use App\Role; |
||
| 9 | use App\User; |
||
| 10 | use Illuminate\Http\Request; |
||
| 11 | use App\Session\Flash; |
||
| 12 | use Illuminate\Support\Facades\Hash; |
||
| 13 | |||
| 14 | class UsersController extends Controller |
||
| 15 | { |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Display a listing of the resource. |
||
| 19 | * @return \Illuminate\Http\Response |
||
| 20 | */ |
||
| 21 | public function index() |
||
| 22 | { |
||
| 23 | return view('admin.users.index', ['users' => User::paginate(config('myio.admin.pagination.items_per_page'))]); |
||
| 24 | } |
||
| 25 | |||
| 26 | |||
| 27 | /** |
||
| 28 | * Show the form for creating a new resource. |
||
| 29 | * @return \Illuminate\Http\Response |
||
| 30 | */ |
||
| 31 | public function create() |
||
| 32 | { |
||
| 33 | return view('admin.users.create', [ |
||
| 34 | 'roles' => Role::all(), |
||
| 35 | ]); |
||
| 36 | } |
||
| 37 | |||
| 38 | |||
| 39 | /** |
||
| 40 | * Store a newly created resource in storage. |
||
| 41 | * |
||
| 42 | * @param UserRequest|Request $request |
||
| 43 | * |
||
| 44 | * @return \Illuminate\Http\Response |
||
| 45 | */ |
||
| 46 | public function store(UserRequest $request) |
||
| 47 | { |
||
| 48 | $user = new User(); |
||
| 49 | $user->name = $request->name; |
||
|
0 ignored issues
–
show
The property
name does not seem to exist in App\Http\Requests\Admin\UserRequest.
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. Loading history...
|
|||
| 50 | $user->password = Hash::make($request->password); |
||
|
0 ignored issues
–
show
The property
password does not exist on object<App\User>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
The property
password does not exist on object<App\Http\Requests\Admin\UserRequest>. 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. Loading history...
|
|||
| 51 | $user->email = $request->email; |
||
|
0 ignored issues
–
show
The property
email does not exist on object<App\User>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
The property
email does not seem to exist in App\Http\Requests\Admin\UserRequest.
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. Loading history...
|
|||
| 52 | $user->activated = $request->activated; |
||
|
0 ignored issues
–
show
The property
activated does not exist on object<App\User>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
The property
activated does not seem to exist in App\Http\Requests\Admin\UserRequest.
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. Loading history...
|
|||
| 53 | $user->email_token = $user->createEmailToken(); |
||
|
0 ignored issues
–
show
The property
email_token does not exist on object<App\User>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
|
|||
| 54 | $user->save(); |
||
| 55 | |||
| 56 | |||
| 57 | $user->assignRole(Role::find($request->role)); |
||
|
0 ignored issues
–
show
The property
role does not exist on object<App\Http\Requests\Admin\UserRequest>. 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. Loading history...
|
|||
| 58 | $user->save(); |
||
| 59 | |||
| 60 | if ($request->has('act_mail')) { |
||
| 61 | $user->notify(new EmailVerification($user)); |
||
| 62 | } |
||
| 63 | |||
| 64 | if ($user->save()) { |
||
| 65 | Flash::success('User created'); |
||
| 66 | } else { |
||
| 67 | Flash::error('Could not create new user.'); |
||
| 68 | } |
||
| 69 | |||
| 70 | return redirect()->route('admin.users.edit', $user['id']); |
||
| 71 | } |
||
| 72 | |||
| 73 | |||
| 74 | /** |
||
| 75 | * Show the form for editing the specified resource. |
||
| 76 | * |
||
| 77 | * @param User $user |
||
| 78 | * |
||
| 79 | * @return \Illuminate\Http\Response |
||
| 80 | * @internal param int $id |
||
| 81 | */ |
||
| 82 | public function edit(User $user) |
||
| 83 | { |
||
| 84 | return view('admin.users.edit', [ |
||
| 85 | 'user' => $user, |
||
| 86 | 'roles' => Role::all(), |
||
| 87 | ]); |
||
| 88 | } |
||
| 89 | |||
| 90 | |||
| 91 | /** |
||
| 92 | * Update the specified resource in storage. |
||
| 93 | * |
||
| 94 | * @param UserRequest|Request $request |
||
| 95 | * @param User $user |
||
| 96 | * |
||
| 97 | * @return \Illuminate\Http\Response |
||
| 98 | * @internal param int $id |
||
| 99 | */ |
||
| 100 | public function update(UserRequest $request, User $user) |
||
| 101 | { |
||
| 102 | $user->fill(['name' => $request->name, 'email' => $request->email, 'activated' => $request->activated])->save(); |
||
|
0 ignored issues
–
show
The property
name does not exist on object<App\Http\Requests\Admin\UserRequest>. 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. Loading history...
The property
email does not exist on object<App\Http\Requests\Admin\UserRequest>. 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. Loading history...
The property
activated does not exist on object<App\Http\Requests\Admin\UserRequest>. 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. Loading history...
|
|||
| 103 | |||
| 104 | if (!empty($request->password)) { |
||
|
0 ignored issues
–
show
The property
password does not exist on object<App\Http\Requests\Admin\UserRequest>. 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. Loading history...
|
|||
| 105 | $user->password = Hash::make($request->password); |
||
|
0 ignored issues
–
show
The property
password does not exist on object<App\User>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?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.");
}
}
}
Since the property has write access only, you can use the @property-write 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. Loading history...
The property
password does not exist on object<App\Http\Requests\Admin\UserRequest>. 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. Loading history...
|
|||
| 106 | } |
||
| 107 | |||
| 108 | $user->removeRole($user->roles->first()->id); |
||
|
0 ignored issues
–
show
The property
roles does not exist on object<App\User>. 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. Loading history...
|
|||
| 109 | $user->assignRole(Role::find($request->role)); |
||
|
0 ignored issues
–
show
The property
role does not exist on object<App\Http\Requests\Admin\UserRequest>. 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. Loading history...
|
|||
| 110 | |||
| 111 | if ($user->save()) { |
||
| 112 | Flash::success('User updated'); |
||
| 113 | } else { |
||
| 114 | Flash::error('Could not update this user.'); |
||
| 115 | } |
||
| 116 | |||
| 117 | |||
| 118 | return redirect()->route('admin.users.edit', $user['id']); |
||
| 119 | } |
||
| 120 | |||
| 121 | |||
| 122 | /** |
||
| 123 | * Remove the specified resource from storage. |
||
| 124 | * |
||
| 125 | * @param User $user |
||
| 126 | * |
||
| 127 | * @return \Illuminate\Http\Response |
||
| 128 | * @internal param int $id |
||
| 129 | */ |
||
| 130 | public function destroy(User $user) |
||
| 131 | { |
||
| 132 | |||
| 133 | if ($user->delete()) { |
||
| 134 | Flash::success('User deleted.'); |
||
| 135 | } else { |
||
| 136 | Flash::error('Could not delete this user.'); |
||
| 137 | } |
||
| 138 | |||
| 139 | return redirect()->route('admin.users.index'); |
||
| 140 | } |
||
| 141 | } |
||
| 142 |
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write 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.