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 | use Illuminate\Database\Seeder; |
||
3 | /** |
||
4 | * Usage : |
||
5 | * [1] $ composer dump-autoload -o |
||
6 | * [2] $ php artisan db:seed --class=BantenprovDataAkademikSeeder |
||
7 | */ |
||
8 | class BantenprovDataAkademikSeeder extends Seeder |
||
0 ignored issues
–
show
|
|||
9 | { |
||
10 | /* text color */ |
||
11 | protected $RED ="\033[0;31m"; |
||
12 | protected $CYAN ="\033[0;36m"; |
||
13 | protected $YELLOW ="\033[1;33m"; |
||
14 | protected $ORANGE ="\033[0;33m"; |
||
15 | protected $PUR ="\033[0;35m"; |
||
16 | protected $GRN ="\e[32m"; |
||
17 | protected $WHI ="\e[37m"; |
||
18 | protected $NC ="\033[0m"; |
||
19 | /* File name */ |
||
20 | /* location : /databse/seeds/file_name.csv */ |
||
21 | protected $fileName = "BantenprovDataAkademikSeeder.csv"; |
||
22 | /* text info : default (true) */ |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
42% 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. ![]() |
|||
23 | protected $textInfo = true; |
||
24 | /* model class */ |
||
25 | protected $model; |
||
26 | /* __construct */ |
||
27 | public function __construct(){ |
||
28 | $this->model = new Bantenprov\DataAkademik\Models\Bantenprov\DataAkademik\DataAkademik; |
||
29 | } |
||
30 | /** |
||
31 | * Run the database seeds. |
||
32 | * |
||
33 | * @return void |
||
34 | */ |
||
35 | public function run() |
||
36 | { |
||
37 | $this->insertData(); |
||
38 | } |
||
39 | /* function insert data */ |
||
40 | protected function insertData() |
||
41 | { |
||
42 | /* silahkan di rubah sesuai kebutuhan */ |
||
43 | foreach($this->readCSV() as $data){ |
||
44 | |||
45 | $this->model->create([ |
||
46 | 'user_id' => $data['user_id'], |
||
47 | 'nomor_un' => $data['nomor_un'], |
||
48 | 'nomor_kk' => $data['nomor_kk'], |
||
49 | 'nisn' => $data['nisn'], |
||
50 | 'nama_siswa' => $data['nama_siswa'], |
||
51 | 'bahasa_indonesia' => $data['bahasa_indonesia'], |
||
52 | 'bahasa_inggris' => $data['bahasa_inggris'], |
||
53 | 'matematika' => $data['matematika'], |
||
54 | 'ipa' => $data['ipa'], |
||
55 | 'tempat_lahir' => $data['tempat_lahir'], |
||
56 | 'tanggal_lahir' => $data['tanggal_lahir'], |
||
57 | 'jenis_kelamin' => $data['jenis_kelamin'], |
||
58 | 'nama_ortu' => $data['nama_ortu'], |
||
59 | 'alamat' => $data['alamat'], |
||
60 | 'npsn_asal_sekolah' => $data['npsn_asal_sekolah'], |
||
61 | 'asal_sekolah' => $data['asal_sekolah'], |
||
62 | |||
63 | ]); |
||
64 | |||
65 | if($this->textInfo){ |
||
66 | echo "============[DATA]============\n"; |
||
67 | $this->orangeText('nama_siswa : ').$this->greenText($data['nama_siswa']); |
||
68 | echo"\n"; |
||
69 | $this->orangeText('nomor_un : ').$this->greenText($data['nomor_un']); |
||
70 | echo"\n"; |
||
71 | $this->orangeText('nomor_kk : ').$this->greenText($data['nomor_kk']); |
||
72 | echo"\n"; |
||
73 | $this->orangeText('nama_siswa : ').$this->greenText($data['nama_siswa']); |
||
74 | echo"\n"; |
||
75 | $this->orangeText('bahasa_indonesia : ').$this->greenText($data['bahasa_indonesia']); |
||
76 | echo"\n"; |
||
77 | $this->orangeText('bahasa_inggris : ').$this->greenText($data['bahasa_inggris']); |
||
78 | echo"\n"; |
||
79 | $this->orangeText('matematika : ').$this->greenText($data['matematika']); |
||
80 | echo"\n"; |
||
81 | $this->orangeText('ipa : ').$this->greenText($data['ipa']); |
||
82 | echo"\n"; |
||
83 | $this->orangeText('nisn : ').$this->greenText($data['nisn']); |
||
84 | echo"\n"; |
||
85 | $this->orangeText('tempat_lahir : ').$this->greenText($data['tempat_lahir']); |
||
86 | echo"\n"; |
||
87 | $this->orangeText('tanggal_lahir : ').$this->greenText($data['tanggal_lahir']); |
||
88 | echo"\n"; |
||
89 | $this->orangeText('jenis_kelamin : ').$this->greenText($data['jenis_kelamin']); |
||
90 | echo"\n"; |
||
91 | $this->orangeText('nama_ortu : ').$this->greenText($data['nama_ortu']); |
||
92 | echo"\n"; |
||
93 | $this->orangeText('alamat : ').$this->greenText($data['alamat']); |
||
94 | echo"\n"; |
||
95 | $this->orangeText('npsn_asal_sekolah : ').$this->greenText($data['npsn_asal_sekolah']); |
||
96 | echo"\n"; |
||
97 | $this->orangeText('asal_sekolah : ').$this->greenText($data['asal_sekolah']); |
||
98 | echo"\n"; |
||
99 | |||
100 | echo "============[DATA]============\n\n"; |
||
101 | } |
||
102 | |||
103 | } |
||
104 | |||
105 | |||
106 | |||
107 | $this->greenText('[ SEEDER DONE ]'); |
||
108 | echo"\n\n"; |
||
109 | } |
||
110 | /* text color: orange */ |
||
111 | protected function orangeText($text) |
||
112 | { |
||
113 | printf($this->ORANGE.$text.$this->NC); |
||
114 | } |
||
115 | /* text color: green */ |
||
116 | protected function greenText($text) |
||
117 | { |
||
118 | printf($this->GRN.$text.$this->NC); |
||
119 | } |
||
120 | /* function read CSV file */ |
||
121 | protected function readCSV() |
||
122 | { |
||
123 | $file = fopen(database_path("seeds/".$this->fileName), "r"); |
||
124 | $all_data = array(); |
||
125 | $row = 1; |
||
0 ignored issues
–
show
$row 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 ![]() |
|||
126 | while(($data = fgetcsv($file, 1000, ",")) !== FALSE){ |
||
127 | $all_data[] = [ |
||
128 | 'user_id' => $data[0], |
||
129 | 'nomor_un' => $data[1], |
||
130 | 'nomor_kk' => $data[2], |
||
131 | 'nisn' => $data[3], |
||
132 | 'nama_siswa' => $data[4], |
||
133 | 'bahasa_indonesia' => $data[5], |
||
134 | 'bahasa_inggris' => $data[6], |
||
135 | 'matematika' => $data[7], |
||
136 | 'ipa' => $data[8], |
||
137 | 'tempat_lahir' => $data[9], |
||
138 | 'tanggal_lahir' => $data[10], |
||
139 | 'jenis_kelamin' => $data[11], |
||
140 | 'nama_ortu' => $data[12], |
||
141 | 'alamat' => $data[13], |
||
142 | 'npsn_asal_sekolah' => $data[14], |
||
143 | 'asal_sekolah' => $data[15], |
||
144 | ]; |
||
145 | } |
||
146 | fclose($file); |
||
147 | return $all_data; |
||
148 | } |
||
149 | } |
||
150 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.