@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | class BantenprovAnggaranSeeder extends Seeder |
12 | 12 | { |
13 | 13 | /* text color */ |
14 | - protected $RED ="\033[0;31m"; |
|
15 | - protected $CYAN ="\033[0;36m"; |
|
16 | - protected $YELLOW ="\033[1;33m"; |
|
17 | - protected $ORANGE ="\033[0;33m"; |
|
18 | - protected $PUR ="\033[0;35m"; |
|
19 | - protected $GRN ="\e[32m"; |
|
20 | - protected $WHI ="\e[37m"; |
|
21 | - protected $NC ="\033[0m"; |
|
14 | + protected $RED = "\033[0;31m"; |
|
15 | + protected $CYAN = "\033[0;36m"; |
|
16 | + protected $YELLOW = "\033[1;33m"; |
|
17 | + protected $ORANGE = "\033[0;33m"; |
|
18 | + protected $PUR = "\033[0;35m"; |
|
19 | + protected $GRN = "\e[32m"; |
|
20 | + protected $WHI = "\e[37m"; |
|
21 | + protected $NC = "\033[0m"; |
|
22 | 22 | |
23 | 23 | /* File name */ |
24 | 24 | /* location : /databse/seeds/file_name.csv */ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | protected $model; |
32 | 32 | |
33 | 33 | /* __construct */ |
34 | - public function __construct(){ |
|
34 | + public function __construct() { |
|
35 | 35 | |
36 | 36 | $this->model = new Bantenprov\Anggaran\Models\Bantenprov\Anggaran\Anggaran; |
37 | 37 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | protected function insertData() |
52 | 52 | { |
53 | 53 | /* silahkan di rubah sesuai kebutuhan */ |
54 | - foreach($this->readCSV() as $data){ |
|
54 | + foreach ($this->readCSV() as $data) { |
|
55 | 55 | |
56 | 56 | $this->model->create([ |
57 | 57 | 'user_id' => $data['user_id'], |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'link' => $data['link'], |
63 | 63 | ]); |
64 | 64 | |
65 | - if($this->textInfo){ |
|
65 | + if ($this->textInfo) { |
|
66 | 66 | echo "============[DATA]============\n"; |
67 | 67 | $this->orangeText('user_id : ').$this->greenText($data['user_id']); |
68 | 68 | echo"\n"; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $file = fopen(database_path("seeds/".$this->fileName), "r"); |
105 | 105 | $all_data = array(); |
106 | 106 | $row = 1; |
107 | - while(($data = fgetcsv($file, 1000, ",")) !== FALSE){ |
|
107 | + while (($data = fgetcsv($file, 1000, ",")) !== FALSE) { |
|
108 | 108 | $all_data[] = ['user_id' => $data[0], |
109 | 109 | 'label' => $data[1], |
110 | 110 | 'description' => $data[2], |
@@ -10,28 +10,28 @@ |
||
10 | 10 | * |
11 | 11 | * @return void |
12 | 12 | */ |
13 | - public function up() |
|
14 | - { |
|
15 | - Schema::create('anggarans', function(Blueprint $table) { |
|
16 | - $table->increments('id'); |
|
17 | - $table->integer('user_id'); |
|
18 | - $table->integer('group_egovernment_id'); |
|
19 | - $table->integer('sector_egovernment_id'); |
|
20 | - $table->string('label'); |
|
21 | - $table->string('description'); |
|
22 | - $table->string('link'); |
|
23 | - $table->timestamps(); |
|
24 | - $table->softDeletes(); |
|
25 | - }); |
|
26 | - } |
|
13 | + public function up() |
|
14 | + { |
|
15 | + Schema::create('anggarans', function(Blueprint $table) { |
|
16 | + $table->increments('id'); |
|
17 | + $table->integer('user_id'); |
|
18 | + $table->integer('group_egovernment_id'); |
|
19 | + $table->integer('sector_egovernment_id'); |
|
20 | + $table->string('label'); |
|
21 | + $table->string('description'); |
|
22 | + $table->string('link'); |
|
23 | + $table->timestamps(); |
|
24 | + $table->softDeletes(); |
|
25 | + }); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Reverse the migrations. |
30 | 30 | * |
31 | 31 | * @return void |
32 | 32 | */ |
33 | - public function down() |
|
34 | - { |
|
35 | - Schema::drop('anggarans'); |
|
36 | - } |
|
33 | + public function down() |
|
34 | + { |
|
35 | + Schema::drop('anggarans'); |
|
36 | + } |
|
37 | 37 | } |
@@ -219,7 +219,7 @@ |
||
219 | 219 | 'link' => 'required', |
220 | 220 | ]); |
221 | 221 | |
222 | - if($validator->fails()){ |
|
222 | + if($validator->fails()){ |
|
223 | 223 | |
224 | 224 | foreach($validator->messages()->getMessages() as $key => $error){ |
225 | 225 | foreach($error AS $error_get) { |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | protected $anggaran; |
35 | 35 | protected $user; |
36 | 36 | |
37 | - public function __construct(Anggaran $anggaran, GroupEgovernment $group_egovernment,SectorEgovernment $sector_egovernment, User $user) |
|
37 | + public function __construct(Anggaran $anggaran, GroupEgovernment $group_egovernment, SectorEgovernment $sector_egovernment, User $user) |
|
38 | 38 | { |
39 | - $this->anggaran = $anggaran; |
|
40 | - $this->group_egovernmentModel = $group_egovernment; |
|
41 | - $this->sector_egovernment = $sector_egovernment; |
|
42 | - $this->user = $user; |
|
39 | + $this->anggaran = $anggaran; |
|
40 | + $this->group_egovernmentModel = $group_egovernment; |
|
41 | + $this->sector_egovernment = $sector_egovernment; |
|
42 | + $this->user = $user; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $sector_egovernment = $this->sector_egovernment->all(); |
97 | 97 | $users = $this->user->all(); |
98 | 98 | |
99 | - foreach($users as $user){ |
|
99 | + foreach ($users as $user) { |
|
100 | 100 | array_set($user, 'label', $user->name); |
101 | 101 | } |
102 | 102 | |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | 'description' => 'required', |
127 | 127 | ]); |
128 | 128 | |
129 | - if($validator->fails()){ |
|
130 | - $check = $anggaran->where('label',$request->label)->whereNull('deleted_at')->count(); |
|
129 | + if ($validator->fails()) { |
|
130 | + $check = $anggaran->where('label', $request->label)->whereNull('deleted_at')->count(); |
|
131 | 131 | |
132 | 132 | if ($check > 0) { |
133 | - $response['message'] = 'Failed, label ' . $request->label . ' already exists'; |
|
133 | + $response['message'] = 'Failed, label '.$request->label.' already exists'; |
|
134 | 134 | } else { |
135 | 135 | $anggaran->group_egovernment_id = $request->input('group_egovernment_id'); |
136 | 136 | $anggaran->sector_egovernment_id = $request->input('sector_egovernment_id'); |
@@ -219,11 +219,11 @@ discard block |
||
219 | 219 | 'link' => 'required', |
220 | 220 | ]); |
221 | 221 | |
222 | - if($validator->fails()){ |
|
222 | + if ($validator->fails()) { |
|
223 | 223 | |
224 | - foreach($validator->messages()->getMessages() as $key => $error){ |
|
225 | - foreach($error AS $error_get) { |
|
226 | - array_push($message, $error_get. "\n"); |
|
224 | + foreach ($validator->messages()->getMessages() as $key => $error) { |
|
225 | + foreach ($error AS $error_get) { |
|
226 | + array_push($message, $error_get."\n"); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | $response['message'] = $message; |