Issues (225)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

stubs/Api/Controller/Controller.php (6 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 19 and the first side effect is on line 8.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
namespace App\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Pagination\Paginator;
7
use App\Http\Controllers\Controller;
8
use App\Models\{{class_name}};
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected '{', expecting T_STRING or T_FUNCTION or T_CONST
Loading history...
9
use Schema;
10
// relationship tables use classes
11
{{relationship_tables_classes}}
12
// eager use classes
13
{{eager_use_classes}}
14
15
class {{class_name}}Controller extends Controller
16
{
17
	// blade views
18
	// index view
19
	public function index()
20
	{
21
		return view('{{class_name_lw}}.index');
22
	}
23
	// create view
24
	public function create()
25
	{
26
		return view('{{class_name_lw}}.create');
27
	}
28
29
	// edit view
30
	public function edit($id)
31
	{
32
		${{class_name_lw}} = {{class_name}}::find($id);
33
34
		return view('{{class_name_lw}}.edit')->with('model', ${{class_name_lw}});
35
	}
36
37
	// api resources
38
	
39
40
	// save {{class_name_lw}}
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
41
	public function store(Request $request)
42
	{
43
		// validate {{class_name_lw}} and eager objects
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
44
		$this->validate($request, $this->getRules());
45
		
46
		$model = new {{class_name}}();
47
48
		${{class_name_lw}} = $model->store($request);
49
50
		return ${{class_name_lw}};
51
	}
52
53
	// update {{class_name_lw}} by id
54
	public function update($id, Request $request)
55
	{
56
		// validate {{table_name}} and eager objects
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
57
		$this->validate($request, $this->getRules($id));
58
		
59
		$model = new {{class_name}}();
60
		${{class_name_lw}} = $model->updateModel($id, $request);
61
62
		return ${{class_name_lw}};
63
	}
64
65
66
	// get {{class_name_lw}} by id
67
	public function show($id)
68
	{
69
		$model = new {{class_name}}();
70
		${{class_name_lw}} = $model->show($id);
71
		return ${{class_name_lw}} ;
72
	}
73
74
	// find first by field and value
75
	public function findByField(Request $request)
76
	{
77
		$model = new {{class_name}}();
78
		${{class_name_lw}} = $model->findByField($request);
79
		return ${{class_name_lw}} ;
80
	}
81
82
	// build all validation rules
83
	protected function getRules($id = null){
84
		// default object rules
85
		$model = new {{class_name}}();
86
		$rules = $model::$rules;
87
		${{class_name_lw}} = $model->show($id);
88
		{{unique_rules}}
89
		// nested rules for eager objects
90
		{{rules_eager}}
91
		
92
		return $rules;
93
	}
94
95
	// delete model by ids
96
	public function destroy($id)
97
	{
98
		$ids = explode(",", $id);
99
	    $ids = array_unique($ids);
100
101
	    $model = new {{class_name}}();
102
103
	    $success = $model->destroy($ids);
104
105
	    $status = array("error" => true, "message" => "Error deleting object");
106
		if ($success)
107
			$status = array("error" => false, "message" => "Object successfully deleted");
108
109
		return json_encode($status);
110
111
	}
112
113
	{{reverseRelationships}}
114
	{{relationship_tables_store}}
115
	{{remove_relationship_objects}}
116
	{{enum}}
117
	{{checkbox}}
118
119
120
	// query with search and pagination options
121
	public function query(Request $request)
122
	{
123
		$model = new {{class_name}}();
124
125
		$query = $model->querySearch($request);
126
127
		return $query;
128
	}
129
130
131
	// query with fields filters and pagination
132
	//json = {"pagination": {"actual": 1, "itensPerPage": 20}, "fields": ["name","email","cnpj"], "orderBy": "name"}
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
133
	public function queryFilters(Request $request)
134
	{
135
		$model = new {{class_name}}();
136
137
		${{class_name_lw}} = $model->queryFilters($request);
138
		
139
		return ${{class_name_lw}};
140
	}
141
142
	
143
}
144