idevelopment /
timecontrol
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; |
||
| 4 | |||
| 5 | use Illuminate\Http\Request; |
||
| 6 | use App\Http\Requests; |
||
| 7 | use App\Sick; |
||
| 8 | use App\User; |
||
| 9 | |||
| 10 | class SickController extends Controller |
||
| 11 | { |
||
| 12 | public function __construct() |
||
| 13 | { |
||
| 14 | $this->middleware('auth'); |
||
| 15 | } |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Display a listing of the resource. |
||
| 19 | * |
||
| 20 | * @return \Illuminate\Http\Response |
||
| 21 | */ |
||
| 22 | public function index() |
||
| 23 | { |
||
| 24 | $adata = sick::All(); |
||
| 25 | return view('sick/home', ['adata' => $adata]); |
||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Show the form for creating a new resource. |
||
| 30 | * |
||
| 31 | * @return \Illuminate\Http\Response |
||
| 32 | */ |
||
| 33 | public function create() |
||
| 34 | { |
||
| 35 | $users = User::All(); |
||
| 36 | return view('sick/register', ['users' => $users]); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Store a newly created resource in storage. |
||
| 41 | * |
||
| 42 | * @param \Illuminate\Http\Request $request |
||
| 43 | * @return \Illuminate\Http\Response |
||
| 44 | */ |
||
| 45 | public function store(Request $request) |
||
| 46 | { |
||
| 47 | $this->validate($request, [ |
||
| 48 | 'type' => 'required', |
||
| 49 | 'start_date' => 'required', |
||
| 50 | 'stop_date' => 'required', |
||
| 51 | 'employee' => 'required', |
||
| 52 | ]); |
||
| 53 | |||
| 54 | $matchThese = ['user_id' => $request->get('employee'), 'start_date' => $request->get('start_date')]; |
||
| 55 | $verify = sick::where($matchThese)->first(); |
||
| 56 | if ($verify === null) { |
||
| 57 | // user doesn't exist |
||
| 58 | |||
| 59 | $data = new sick; |
||
| 60 | $data->type = $request->get('type'); |
||
|
0 ignored issues
–
show
|
|||
| 61 | $data->start_date = $request->get('start_date'); |
||
|
0 ignored issues
–
show
The property
start_date does not exist on object<App\Sick>. 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...
|
|||
| 62 | $data->end_date = $request->get('stop_date'); |
||
|
0 ignored issues
–
show
The property
end_date does not exist on object<App\Sick>. 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...
|
|||
| 63 | $data->user_id = $request->get('employee'); |
||
|
0 ignored issues
–
show
The property
user_id does not exist on object<App\Sick>. 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...
|
|||
| 64 | $data->description = $request->get('description'); |
||
|
0 ignored issues
–
show
The property
description does not exist on object<App\Sick>. 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...
|
|||
| 65 | $data->save(); |
||
| 66 | |||
| 67 | $user_id = $request->get('employee'); |
||
|
0 ignored issues
–
show
$user_id is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 68 | $subject = \Lang::get('tasks.new_sick_notification'); |
||
| 69 | $mailbox = env('MAIL_USERNAME'); |
||
| 70 | |||
| 71 | \Session::flash('message', "Information has been saved to the database"); |
||
| 72 | \Mail::send('emails.new_sick', ['data' => $data], function ($m) use ($mailbox, $subject) { |
||
| 73 | $m->from($mailbox); |
||
| 74 | $m->to("[email protected]")->subject("$subject"); |
||
| 75 | }); |
||
| 76 | |||
| 77 | return redirect('sick'); |
||
| 78 | } else { |
||
| 79 | \Session::flash('error', "This data has already been saved"); |
||
| 80 | return redirect('sick'); |
||
| 81 | } |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Display the specified resource. |
||
| 86 | * |
||
| 87 | * @param int $id |
||
| 88 | * @return \Illuminate\Http\Response |
||
| 89 | */ |
||
| 90 | public function show($id) |
||
| 91 | { |
||
| 92 | $data = sick::findOrFail($id); |
||
| 93 | return view('sick/info', ['data' => $data, 'data_id' => $id]); |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Show the form for editing the specified resource. |
||
| 98 | * |
||
| 99 | * @param int $id |
||
| 100 | * @return \Illuminate\Http\Response |
||
| 101 | */ |
||
| 102 | public function edit($id) |
||
|
0 ignored issues
–
show
|
|||
| 103 | { |
||
| 104 | // |
||
| 105 | } |
||
| 106 | |||
| 107 | /** |
||
| 108 | * Update the specified resource in storage. |
||
| 109 | * |
||
| 110 | * @param \Illuminate\Http\Request $request |
||
| 111 | * @param int $id |
||
| 112 | * @return \Illuminate\Http\Response |
||
| 113 | */ |
||
| 114 | public function update(Request $request, $id) |
||
|
0 ignored issues
–
show
|
|||
| 115 | { |
||
| 116 | // |
||
| 117 | } |
||
| 118 | |||
| 119 | /** |
||
| 120 | * Remove the specified resource from storage. |
||
| 121 | * |
||
| 122 | * @param int $id |
||
| 123 | * @return \Illuminate\Http\Response |
||
| 124 | */ |
||
| 125 | public function destroy($id) |
||
|
0 ignored issues
–
show
|
|||
| 126 | { |
||
| 127 | // |
||
| 128 | } |
||
| 129 | } |
||
| 130 |
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.