Skip to content

Commit 04e6623

Browse files
committed
Apply fixes from StyleCI
1 parent fba29b9 commit 04e6623

File tree

8 files changed

+23
-34
lines changed

8 files changed

+23
-34
lines changed

app/Console/Commands/SendReminder.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use App\Helpers\Fonnte;
66
use App\Helpers\Helper;
77
use App\Models\DaftarReminder;
8-
use App\Models\DaftarSp2d;
98
use App\Models\UnitKerja;
109
use App\Models\User;
1110
use Illuminate\Console\Command;
@@ -43,11 +42,9 @@ public function handle()
4342
'{pj}' => $kegiatan->daftar_kegiatanable_type == 'App\Models\UnitKerja' ? UnitKerja::find($kegiatan->daftar_kegiatanable_id)->unit : User::find($kegiatan->daftar_kegiatanable_id)->name,
4443
]);
4544
$response = Fonnte::make()->sendWhatsAppMessage($kegiatan->wa_group_id, $pesan);
46-
$reminder->status = $response['data']['process'] ?? 'Gagal';
45+
$reminder->status = $response['data']['process'] ?? 'Gagal';
4746
$reminder->message_id = $response['data']['id'][0];
4847
$reminder->save();
4948
}
50-
51-
5249
}
5350
}

app/Helpers/Fonnte.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ class Fonnte
1010

1111
// Konstanta endpoint API Fonnte
1212
const ENDPOINTS = [
13-
'send_message' => 'https://api.fonnte.com/send',
14-
'update_group' =>'https://api.fonnte.com/fetch-group',
15-
'list_group' =>'https://api.fonnte.com/get-whatsapp-group',
13+
'send_message' => 'https://api.fonnte.com/send',
14+
'update_group' => 'https://api.fonnte.com/fetch-group',
15+
'list_group' => 'https://api.fonnte.com/get-whatsapp-group',
1616

1717
];
1818

@@ -28,35 +28,35 @@ public function __construct()
2828

2929
protected function makeRequest($endpoint, $params = [])
3030
{
31-
$token = $this->account_token;
31+
$token = $this->account_token;
3232

33-
if (!$token) {
33+
if (! $token) {
3434
return ['status' => false, 'error' => 'API token or device token is required.'];
3535
}
3636

3737
// Gunakan JSON format dan pastikan Content-Type header benar
3838
$response = Http::withHeaders([
3939
'Authorization' => $token,
40-
'Content-Type' => 'application/json', // Tambahkan header
40+
'Content-Type' => 'application/json', // Tambahkan header
4141
])->post($endpoint, $params);
4242

4343
if ($response->failed()) {
4444
return [
4545
'status' => false,
46-
'error' => $response->json()['reason'] ?? 'Unknown error occurred',
46+
'error' => $response->json()['reason'] ?? 'Unknown error occurred',
4747
];
4848
}
4949

5050
return [
5151
'status' => true,
52-
'data' => $response->json(),
52+
'data' => $response->json(),
5353
];
5454
}
5555

5656
public function sendWhatsAppMessage($phoneNumber, $message)
5757
{
5858
return $this->makeRequest(self::ENDPOINTS['send_message'], [
59-
'target' => $phoneNumber,
59+
'target' => $phoneNumber,
6060
'message' => $message,
6161
]);
6262
}
@@ -70,5 +70,4 @@ public function getWhatsappGroupList()
7070
{
7171
return $this->makeRequest(self::ENDPOINTS['list_group']);
7272
}
73-
74-
}
73+
}

app/Helpers/Helper.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ public static function getTanggalSebelum($tanggal_deadline, $jumlah_hari, $ref =
443443
$hariLibur = array_map(function ($date) {
444444
return Carbon::parse($date)->format('Y-m-d');
445445
}, $hariLibur);
446-
446+
447447
$count = 0;
448448
while ($count < $jumlah_hari) {
449449
$tanggal_deadline->subDay();
@@ -452,9 +452,7 @@ public static function getTanggalSebelum($tanggal_deadline, $jumlah_hari, $ref =
452452
}
453453
$count++;
454454
}
455-
456-
}
457-
else {
455+
} else {
458456
$tanggal_deadline->subDay($jumlah_hari);
459457
}
460458

@@ -1523,6 +1521,7 @@ public static function setOptionsWaGroup()
15231521
$result[$group['id']] = $group['name'];
15241522
}
15251523
}
1524+
15261525
return $result;
15271526
}
15281527

app/Nova/DaftarKegiatan.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Laravel\Nova\Actions\Action;
1515
use Laravel\Nova\Actions\DestructiveAction;
1616
use Laravel\Nova\Fields\ActionFields;
17-
use Laravel\Nova\Fields\Badge;
1817
use Laravel\Nova\Fields\Date;
1918
use Laravel\Nova\Fields\FormData;
2019
use Laravel\Nova\Fields\MorphTo;
@@ -234,12 +233,12 @@ public function actions(NovaRequest $request)
234233
}
235234
}
236235
})->standalone();
237-
$actions[] =
238-
Action::using('Stop Reminder', function (ActionFields $fields, Collection $models) {
239-
$model = $models->first();
240-
$model->query()->where('id', $model->id)->update(['status' => 'sent']);
241-
$model->daftarReminder()->update(['status' => 'sent']);
242-
})
236+
$actions[] =
237+
Action::using('Stop Reminder', function (ActionFields $fields, Collection $models) {
238+
$model = $models->first();
239+
$model->query()->where('id', $model->id)->update(['status' => 'sent']);
240+
$model->daftarReminder()->update(['status' => 'sent']);
241+
})
243242
->showInline()
244243
->showOnDetail()
245244
->canSee(function ($request) {

app/Nova/DaftarReminder.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace App\Nova;
44

55
use App\Helpers\Helper;
6-
use Laravel\Nova\Fields\Badge;
76
use Laravel\Nova\Fields\BelongsTo;
87
use Laravel\Nova\Fields\Date;
98
use Laravel\Nova\Fields\Text;

app/Providers/CalendarDataProvider.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,11 @@ protected function customizeEvent(Event $event): Event
8686
}
8787
if ($event->model()->jenis == 'Kegiatan' || $event->model()->jenis == 'Deadline') {
8888
$pj = $event->model()->daftar_kegiatanable_type == 'App\Models\UnitKerja' ? UnitKerja::find($event->model()->daftar_kegiatanable_id)->unit : User::find($event->model()->daftar_kegiatanable_id)->name;
89-
$event->notes('PJ: '. $pj);
89+
$event->notes('PJ: '.$pj);
9090
}
91-
92-
91+
9392
$event->notes($event->model()->notes);
9493

9594
return $event;
9695
}
97-
98-
9996
}

public/webhook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
// Cek koneksi
3535
if ($conn->connect_error) {
3636
echo json_encode(['error' => 'Failed to connect to MySQL: '.$conn->connect_error]);
37-
exit();
37+
exit;
3838
}
3939

4040
// Mendapatkan data JSON dari input

routes/web.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@
2929
->name('daftar-file')
3030
->middleware(ValidateAccessToken::class)
3131
->prefix(Nova::path());
32-

0 commit comments

Comments
 (0)