chore: stop tracking compiled blade cache
This commit is contained in:
@@ -4,6 +4,8 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Setting;
|
||||
use App\Models\ActivityLog;
|
||||
use App\Models\Role;
|
||||
use App\Helpers\WhatsappHelper;
|
||||
use App\Traits\LogsActivity;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
@@ -24,7 +26,10 @@ class SettingController extends Controller
|
||||
'app_slogan',
|
||||
'app_version', // Tambahan baru
|
||||
'app_address',
|
||||
'wa_number'
|
||||
'wa_number',
|
||||
'notif_hpl_role_id',
|
||||
'notif_inventory_role_id',
|
||||
'notif_weight_role_id'
|
||||
];
|
||||
|
||||
public function index()
|
||||
@@ -46,7 +51,8 @@ class SettingController extends Controller
|
||||
->take(5)
|
||||
->get();
|
||||
|
||||
return view('pages.admin.settings', compact('settings', 'waStatus', 'emailStatus', 'logs'));
|
||||
$roles = Role::orderBy('name')->get(['id','name']);
|
||||
return view('pages.admin.settings', compact('settings', 'waStatus', 'emailStatus', 'logs', 'roles'));
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
@@ -76,7 +82,21 @@ class SettingController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$this->logAction('UPDATED_SETTINGS', null, "Memperbarui identitas sistem ke versi " . $request->app_version);
|
||||
foreach (['notif_hpl_wa','notif_inventory_expiry_wa','notif_weight_stale_wa','notif_wa_status'] as $notificationKey) {
|
||||
Setting::updateOrCreate(
|
||||
['key' => $notificationKey],
|
||||
['value' => $request->boolean($notificationKey) ? 'active' : 'inactive', 'group' => 'notification']
|
||||
);
|
||||
}
|
||||
|
||||
foreach (['notif_hpl_role_id','notif_inventory_role_id','notif_weight_role_id'] as $roleKey) {
|
||||
if ($request->filled($roleKey)) {
|
||||
$request->validate([$roleKey => 'exists:roles,id']);
|
||||
Setting::updateOrCreate(['key' => $roleKey], ['value' => $request->input($roleKey), 'group' => 'notification']);
|
||||
}
|
||||
}
|
||||
|
||||
$this->logAction('UPDATED_SETTINGS', null, "Memperbarui identitas dan notifikasi sistem ke versi " . $request->app_version);
|
||||
|
||||
return back()->with('success', 'Konfigurasi ' . $request->app_name . ' berhasil diperbarui!');
|
||||
}
|
||||
@@ -104,21 +124,12 @@ class SettingController extends Controller
|
||||
|
||||
private function checkWhatsAppService()
|
||||
{
|
||||
// Gunakan cache atau timeout pendek agar page load tidak berat
|
||||
try {
|
||||
$response = Http::timeout(3)->withHeaders([
|
||||
'Authorization' => config('services.fonnte.token') ?? env('FONNTE_TOKEN'),
|
||||
])->post('https://api.fonnte.com/device');
|
||||
|
||||
$data = $response->json();
|
||||
return [
|
||||
'active' => ($data['status'] ?? false) == true,
|
||||
'quota' => $data['quota'] ?? 0,
|
||||
'message' => ($data['status'] ?? false) ? 'API Terhubung' : ($data['reason'] ?? 'Perangkat tidak aktif')
|
||||
];
|
||||
} catch (\Exception $e) {
|
||||
return ['active' => false, 'quota' => 0, 'message' => 'Layanan WA Offline'];
|
||||
}
|
||||
$provider = strtoupper((string) config('services.whatsapp.provider', 'fonnte'));
|
||||
return [
|
||||
'active' => WhatsappHelper::configured(),
|
||||
'quota' => null,
|
||||
'message' => WhatsappHelper::configured() ? "{$provider} dikonfigurasi" : "{$provider} belum dikonfigurasi",
|
||||
];
|
||||
}
|
||||
|
||||
private function checkEmailService()
|
||||
|
||||
Reference in New Issue
Block a user