diff --git a/app/Helpers/Api.php b/app/Helpers/Api.php index 27b962ed..9e599366 100644 --- a/app/Helpers/Api.php +++ b/app/Helpers/Api.php @@ -7,6 +7,11 @@ class Api { + /** + * Get unresolved issues from Sentry. + * + * @return array + */ public static function getSentryUnresolvedIssues() { $organization = config('app.sentry_organization'); @@ -30,6 +35,12 @@ public static function getSentryUnresolvedIssues() } } + /** + * Get outdated packages from Composer. + * + * @param string $flag + * @return array + */ public static function getComposerOutdatedPackages($flag = '--no-dev') { $composer = config('app.composer'); diff --git a/app/Helpers/Cetak.php b/app/Helpers/Cetak.php index 25abea2a..543ca73c 100644 --- a/app/Helpers/Cetak.php +++ b/app/Helpers/Cetak.php @@ -30,12 +30,16 @@ class Cetak { /** - * Cetak Dokumen. + * Print a document. * - * @param string $jenis kak|spj|sk|st|dpr|spd|bon - * @param collection $model - * @param string $filename - * @return string + * @param string $jenis The type of document (kak|spj|sk|st|dpr|spd|bon) + * @param collection $model The model collection + * @param string $filename The filename for the document + * @param int $template_id The template ID + * @param string|null $tanggal The date (optional) + * @param string|null $pengelola The manager (optional) + * @return string The filename of the saved document + * @throws \Exception */ public static function cetak($jenis, $models, $filename, $template_id, $tanggal = null, $pengelola = null) { @@ -65,9 +69,13 @@ public static function cetak($jenis, $models, $filename, $template_id, $tanggal } /** - * Ambil TemplateProsessor. + * Get the TemplateProcessor. * - * @param string $jenis kak|spj|sk|st|dpr|spd|bon + * @param string $jenis The type of document (kak|spj|sk|st|dpr|spd|bon) + * @param int $id The ID of the model + * @param int $template_id The template ID + * @param string|null $tanggal The date (optional) + * @param string|null $pengelola The manager (optional) * @return TemplateProcessor */ public static function getTemplate(string $jenis, $id, $template_id, $tanggal, $pengelola) @@ -169,7 +177,7 @@ public static function getTemplate(string $jenis, $id, $template_id, $tanggal, $ } /** - * Ambil XML dari dokumen utama. + * Get the XML from the main document. * * @param TemplateProcessor $templateProcessor * @return string @@ -180,7 +188,7 @@ public static function getMainXml($templateProcessor) } /** - * Ambil XML dari dokumen yangakan digabung. + * Get the XML from the document to be merged. * * @param TemplateProcessor $templateProcessor * @return string @@ -195,9 +203,9 @@ public static function getModifiedInnerXml($templateProcessor) } /** - * Format nilai KAK. + * Format the KAK values. * - * @param string $id + * @param string $id The ID of the KAK * @return array */ public static function kak($id) @@ -409,9 +417,9 @@ public static function kuitansi($id) } /** - * Format nilai SPJ. + * Format the SPJ values. * - * @param string $id + * @param string $id The ID of the SPJ * @return array */ public static function spj($id) diff --git a/app/Helpers/Fonnte.php b/app/Helpers/Fonnte.php index 18605bbf..16ee356d 100644 --- a/app/Helpers/Fonnte.php +++ b/app/Helpers/Fonnte.php @@ -26,6 +26,13 @@ public function __construct() $this->account_token = config('fonnte.token'); } + /** + * Make a request to the Fonnte API. + * + * @param string $endpoint The API endpoint to call. + * @param array $params The parameters to send with the request. + * @return array The response from the API. + */ protected function makeRequest($endpoint, $params = []) { $token = $this->account_token; @@ -53,6 +60,13 @@ protected function makeRequest($endpoint, $params = []) ]; } + /** + * Send a WhatsApp message using the Fonnte API. + * + * @param string $phoneNumber The phone number to send the message to. + * @param string $message The message to send. + * @return array The response from the API. + */ public function sendWhatsAppMessage($phoneNumber, $message) { return $this->makeRequest(self::ENDPOINTS['send_message'], [ @@ -61,11 +75,21 @@ public function sendWhatsAppMessage($phoneNumber, $message) ]); } + /** + * Update the WhatsApp group list using the Fonnte API. + * + * @return array The response from the API. + */ public function updateWhatsappGroupList() { return $this->makeRequest(self::ENDPOINTS['update_group']); } + /** + * Get the WhatsApp group list using the Fonnte API. + * + * @return array The response from the API. + */ public function getWhatsappGroupList() { return $this->makeRequest(self::ENDPOINTS['list_group']); diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 499c2d65..08f824bd 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -259,6 +259,12 @@ class Helper 'IV/e' => 15, ]; + /** + * Get the name of the last sheet in an Excel file. + * + * @param string $file The path to the Excel file. + * @return string The name of the last sheet. + */ public static function getLastSheetName($file) { $reader = new Reader; @@ -271,6 +277,12 @@ public static function getLastSheetName($file) return $name; } + /** + * Format a phone number to a WhatsApp URL. + * + * @param string $telepon The phone number to format. + * @return string The formatted WhatsApp URL. + */ public static function formatTelepon($telepon) { $wa = str_replace('+62 08', '628', $telepon); @@ -280,6 +292,12 @@ public static function formatTelepon($telepon) return "https://wa.me/{$wa}"; } + /** + * Check if the current date is within a specific quarter. + * + * @param int $tw The quarter to check (1, 2, 3, or 4). + * @return bool True if the current date is within the specified quarter, false otherwise. + */ public static function is_triwulan($tw) { $now = Carbon::now(); @@ -297,6 +315,12 @@ public static function is_triwulan($tw) } } + /** + * Check if the current date is within a specific cumulative quarter. + * + * @param int $tw The cumulative quarter to check (1, 2, 3, or 4). + * @return bool True if the current date is within the specified cumulative quarter, false otherwise. + */ public static function is_triwulan_kumulatif($tw) { $now = Carbon::now(); @@ -314,6 +338,12 @@ public static function is_triwulan_kumulatif($tw) } } + /** + * Get the current quarter based on the given month. + * + * @param int $month The month to determine the quarter. + * @return int The current quarter (1, 2, 3, or 4). + */ public static function getTriwulanBerjalan($month) { return (int) ceil($month / 3);