Merge pull request #1 from Abi476/init

init
This commit is contained in:
Abi Bayu Rafsanzhany 2026-06-29 14:57:10 +07:00 committed by GitHub
commit 67b99965a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1271 changed files with 98180 additions and 0 deletions

1
CODEOWNERS Normal file
View File

@ -0,0 +1 @@
*@Abi476

View File

@ -0,0 +1,36 @@
# 🐍 DASENA API (Flask) - Damkar Analisis Sentimen API
Aplikasi API yang dikembangkan menggunakan Flask dan Python untuk menjalankan model Natural Language Processing (NLP) dalam menganalisis sentimen publik terhadap layanan Pemadam Kebakaran (Damkar).
---
## 🎯 Fungsi Utama
* **Endpoint Analisis Sentimen:** Menyediakan endpoint POST untuk menerima input teks dan mengembalikan klasifikasi sentimen (Positif, Negatif, Netral).
* **Integrasi Model:** Menghosting dan menjalankan model machine learning/deep learning untuk klasifikasi sentimen.
* **Preprocessing Data:** Menangani proses *tokenization*, *stemming*, dan *cleaning* data sebelum analisis.
## 🛠️ Persyaratan Sistem
* Python 3.x
* Pip
* Virtual Environment
## 📦 Instalasi
1. **Aktifkan Lingkungan Virtual:**
```bash
source venv/bin/activate
# Atau di Windows: .\venv\Scripts\activate
```
2. **Instal Dependensi:**
```bash
pip install -r requirements.txt
```
## ▶️ Cara Menjalankan Server
Jalankan API Flask di port yang berbeda dari Laravel (misalnya Port 5000):
```bash
flask run --port=5000

126
dasena-api-flask/app.py Normal file
View File

@ -0,0 +1,126 @@
from flask import Flask, request, jsonify
from flask_cors import CORS
import re
from Sastrawi.StopWordRemover.StopWordRemoverFactory import StopWordRemoverFactory
from Sastrawi.Stemmer.StemmerFactory import StemmerFactory
import joblib
import os
import numpy as np
app = Flask(__name__)
CORS(app)
# MEMUAT SASTRAWI
print("Memuat dictionary Sastrawi... (Mohon tunggu sebentar)")
factory_stopword = StopWordRemoverFactory()
stopword_remover = factory_stopword.create_stop_word_remover()
factory_stemmer = StemmerFactory()
stemmer = factory_stemmer.create_stemmer()
print("Sastrawi siap!")
# MEMUAT MODEL
print("Memuat Model Naive Bayes & TF-IDF...")
try:
vectorizer = joblib.load("tfidf_vectorizer.pkl")
model = joblib.load("model_naive_bayes_terbaik.pkl")
print("Model Naive Bayes berhasil dimuat dan siap digunakan!")
except Exception as e:
print(f"ERROR: Gagal memuat model. Pastikan file .pkl ada! Detail: {e}")
def clean_text(text):
text = str(text)
text = re.split(r"(?i)\|?\s*(?:translate|ai info)", text)[0]
if "|" in text:
parts = text.split("|")
if len(parts) > 2:
content_parts = parts[2:]
valid_parts = []
for p in content_parts:
p_clean = p.strip()
if re.fullmatch(r"[\d\.,]+[KkMmBb]?", p_clean):
continue
if p_clean == "." or p_clean == "":
continue
valid_parts.append(p_clean)
text = " ".join(valid_parts)
text = re.sub(r"(?i)\breplying to\b", "", text)
text = re.sub(r"@[\w_.]*damkar[\w_.]*", " damkar ", text, flags=re.I)
text = re.sub(r"@[A-Za-z0-9_.]+", "", text)
text = re.sub(r"#.*", "", text)
text = re.sub(r"[🎥📸].*", "", text)
text = re.sub(r"http\S+|www\S+|https\S+", "", text, flags=re.MULTILINE)
text = re.sub(
r"(?i)\b(?:video|vid|foto|poto|credit|credits|source|sumber|sc|cr)\s*[:/]\s*.*",
"",
text,
)
text = re.sub(r"(?i)\b(?:ig|instagram|tiktok|youtube)\s*[:/]\s*\S+.*", "", text)
text = re.sub(
r"(?i)\b(?:report by|story ig|baca selengkapnya|selengkapnya|klik link|di bio|dibio)\b.*",
"",
text,
)
text = re.sub(
r"(?i)\b\w+\.(?:go\.id|co\.id|ac\.id|or\.id|web\.id|com|id|net|org)(?:/\S*)?.*",
"",
text,
)
text = re.sub(r"[^a-zA-Z\s]", " ", text)
cleansed = re.sub(r"\s+", " ", text).strip().lower()
stopword = stopword_remover.remove(cleansed)
stemmed = stemmer.stem(stopword)
return {"cleansed": cleansed, "stopword": stopword, "stemmed": stemmed}
@app.route("/api/preprocess", methods=["POST"])
def preprocess_data():
try:
data = request.json.get("data", [])
results = []
for item in data:
item_id = item.get("id")
teks_asli = item.get("teks", "")
hasil_bersih = clean_text(teks_asli)
teks_stopword = hasil_bersih["stopword"]
teks_stemmed = hasil_bersih["stemmed"]
hasil_sentimen = "Netral"
confidences = {"Positif": 0, "Netral": 0, "Negatif": 0}
if teks_stemmed.strip():
teks_vektor = vectorizer.transform([teks_stemmed])
hasil_sentimen = model.predict(teks_vektor)[0]
if hasattr(model, "predict_proba"):
probs = model.predict_proba(teks_vektor)[0]
classes = model.classes_
for i in range(len(classes)):
confidences[classes[i].capitalize()] = round(
float(probs[i]) * 100, 1
)
results.append(
{
"id": item_id,
"teks_stopword": teks_stopword,
"teks_stemmed": teks_stemmed,
"sentimen": hasil_sentimen,
"confidences": confidences,
}
)
return jsonify({"status": "success", "data": results})
except Exception as e:
return jsonify({"status": "error", "message": str(e)}), 500
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0", port=5000)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

18
dasena-web/.editorconfig Normal file
View File

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[compose.yaml]
indent_size = 4

65
dasena-web/.env.example Normal file
View File

@ -0,0 +1,65 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

11
dasena-web/.gitattributes vendored Normal file
View File

@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore

24
dasena-web/.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
*.log
.DS_Store
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
/.fleet
/.idea
/.nova
/.phpunit.cache
/.vscode
/.zed
/auth.json
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
Homestead.json
Homestead.yaml
Thumbs.db

61
dasena-web/README.md Normal file
View File

@ -0,0 +1,61 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
### Premium Partners
- **[Vehikl](https://vehikl.com)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Redberry](https://redberry.international/laravel-development)**
- **[Active Logic](https://activelogic.com)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

View File

@ -0,0 +1,37 @@
<?php
namespace App\Exports;
use App\Models\DatasetItem;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
class HasilAnalisisExport implements FromQuery, WithHeadings, WithMapping, ShouldAutoSize
{
public function query()
{
return DatasetItem::query()->whereNotNull('teks_stemmed');
}
public function headings(): array
{
return [
'Tanggal',
'Komentar Asli',
'Teks Bersih (Hasil Preprocessing)',
'Sentimen'
];
}
public function map($item): array
{
return [
$item->created_at ? $item->created_at->format('d M Y') : '-',
$item->teks,
$item->teks_stemmed,
$item->sentimen ?? 'Belum Dianalisis',
];
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\WithHeadings;
class TemplateExport implements WithHeadings
{
public function headings(): array
{
return [
'Keyword',
'Tanggal',
'Teks',
];
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\ContactMessage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
class ContactMessageController extends Controller
{
public function index()
{
$messages = ContactMessage::latest()->paginate(15);
return view('admin.contact_messages.index', compact('messages'));
}
public function show($id)
{
$message = ContactMessage::findOrFail($id);
if (!$message->is_read) {
$message->update(['is_read' => true]);
}
return view('admin.contact_messages.show', compact('message'));
}
public function reply(Request $request, $id)
{
$message = ContactMessage::findOrFail($id);
$request->validate([
'reply_text' => 'required|string',
]);
try {
Mail::send('emails.reply-message', ['replyText' => $request->reply_text, 'originalMessage' => $message], function ($mail) use ($message) {
$mail->to($message->email)
->subject('RE: ' . $message->subject);
});
$message->update([
'is_replied' => true,
'reply_text' => $request->reply_text,
]);
return redirect()->back()->with('success', 'Email balasan berhasil dikirim langsung ke warga.');
} catch (\Exception $e) {
return redirect()->back()->with('error', 'Gagal mengirim email balasan! Error: ' . $e->getMessage());
}
}
public function destroy($id)
{
$message = ContactMessage::findOrFail($id);
$message->delete();
return redirect()->route('admin.messages.index')->with('success', 'Pesan berhasil dihapus.');
}
}

View File

@ -0,0 +1,92 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User;
use App\Models\KamusNormalisasi;
use App\Models\DatasetItem;
use App\Models\Dataset;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
class DashboardController extends Controller
{
public function index()
{
$stats = [
'positif' => DatasetItem::where('sentimen', 'Positif')->count(),
'netral' => DatasetItem::where('sentimen', 'Netral')->count(),
'negatif' => DatasetItem::where('sentimen', 'Negatif')->count(),
'total' => DatasetItem::whereNotNull('sentimen')->count(),
];
$trendData = DatasetItem::selectRaw('MONTH(tanggal) as bulan, sentimen, count(*) as jumlah')
->whereNotNull('sentimen')
->whereNotNull('tanggal')
->whereYear('tanggal', '2025')
->groupBy('bulan', 'sentimen')
->get();
$recentComments = DatasetItem::orderBy('tanggal', 'desc')->take(5)->get();
$getWordCloudData = function ($sentimen) {
$texts = DatasetItem::where('sentimen', $sentimen)->pluck('teks_stemmed')->toArray();
$wordCounts = [];
foreach ($texts as $text) {
$words = explode(' ', strtolower($text));
foreach ($words as $word) {
$word = trim($word);
if (strlen($word) > 2) {
if (!isset($wordCounts[$word])) {
$wordCounts[$word] = 0;
}
$wordCounts[$word]++;
}
}
}
arsort($wordCounts);
$topWords = array_slice($wordCounts, 0, 50);
$wordCloudData = [];
foreach ($topWords as $word => $count) {
$wordCloudData[] = ['x' => $word, 'value' => $count];
}
return $wordCloudData;
};
$wordCloudDataPositif = $getWordCloudData('Positif');
$wordCloudDataNetral = $getWordCloudData('Netral');
$wordCloudDataNegatif = $getWordCloudData('Negatif');
$flaskStatus = false;
try {
Http::timeout(2)->send('OPTIONS', env('FLASK_API_URL', 'http://127.0.0.1:5000') . '/api/preprocess');
$flaskStatus = true;
} catch (\Exception $e) {
$flaskStatus = false;
}
$adminData = [
'total_users' => User::count(),
'total_kamus' => KamusNormalisasi::count(),
'pending_prep' => DatasetItem::whereNull('sentimen')->count(),
'total_all_data' => DatasetItem::count(),
'flask_online' => $flaskStatus,
'latest_datasets' => Dataset::latest()->take(3)->get(),
'prediksi_hari_ini' => DatasetItem::whereDate('updated_at', today())
->whereNotNull('sentimen')
->count(),
];
return view('admin.dashboard.index', compact(
'stats',
'trendData',
'recentComments',
'adminData',
'wordCloudDataPositif',
'wordCloudDataNetral',
'wordCloudDataNegatif'
));
}
}

View File

@ -0,0 +1,152 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\KamusNormalisasi;
use Maatwebsite\Excel\Facades\Excel;
class KamusNormalisasiController extends Controller
{
public function index(Request $request)
{
$query = KamusNormalisasi::query();
// Fitur pencarian
if ($request->has('search') && $request->search != '') {
$query->where('kata_tidak_baku', 'like', '%' . $request->search . '%')
->orWhere('kata_baku', 'like', '%' . $request->search . '%');
}
$kamus = $query->latest()->paginate(10);
return view('admin.kamus.index', compact('kamus'));
}
public function store(Request $request)
{
$request->validate([
'kata_tidak_baku' => 'required|unique:kamus_normalisasis,kata_tidak_baku|string|max:255',
'kata_baku' => 'required|string|max:255',
], [
'kata_tidak_baku.unique' => 'Kata tidak baku ini sudah ada di dalam kamus!'
]);
KamusNormalisasi::create([
'kata_tidak_baku' => strtolower(trim($request->kata_tidak_baku)),
'kata_baku' => strtolower(trim($request->kata_baku)),
]);
return back()->with('success', 'Kata berhasil ditambahkan ke kamus!');
}
public function update(Request $request, $id)
{
$kamus = KamusNormalisasi::findOrFail($id);
$request->validate([
'kata_tidak_baku' => 'required|string|max:255|unique:kamus_normalisasis,kata_tidak_baku,' . $id,
'kata_baku' => 'required|string|max:255',
]);
$kamus->update([
'kata_tidak_baku' => strtolower(trim($request->kata_tidak_baku)),
'kata_baku' => strtolower(trim($request->kata_baku)),
]);
return back()->with('success', 'Kamus berhasil diperbarui!');
}
public function destroy($id)
{
$kamus = KamusNormalisasi::findOrFail($id);
$kamus->delete();
return response()->json([
'success' => true,
'message' => 'Kata berhasil dihapus dari kamus!'
]);
}
public function import(Request $request)
{
$request->validate([
'file_import' => 'required|mimes:csv,xlsx,xls|max:5120',
], [
'file_import.required' => 'File wajib dipilih!',
'file_import.mimes' => 'Format file harus CSV, XLSX, atau XLS!',
'file_import.max' => 'Ukuran file maksimal 5 MB!',
]);
try {
$file = $request->file('file_import');
$dataArray = Excel::toArray([], $file);
$rows = $dataArray[0];
array_shift($rows);
$berhasil = 0;
$duplikat = 0;
$kosong = 0;
foreach ($rows as $row) {
$kataTidakBaku = isset($row[0]) ? strtolower(trim($row[0])) : null;
$kataBaku = isset($row[1]) ? strtolower(trim($row[1])) : null;
if (!$kataTidakBaku || !$kataBaku) {
$kosong++;
continue;
}
// Skip jika sudah ada
$sudahAda = KamusNormalisasi::where('kata_tidak_baku', $kataTidakBaku)->exists();
if ($sudahAda) {
$duplikat++;
continue;
}
KamusNormalisasi::create([
'kata_tidak_baku' => $kataTidakBaku,
'kata_baku' => $kataBaku,
]);
$berhasil++;
}
$pesan = "Import selesai: {$berhasil} kata berhasil ditambahkan";
if ($duplikat > 0)
$pesan .= ", {$duplikat} duplikat dilewati";
if ($kosong > 0)
$pesan .= ", {$kosong} baris kosong dilewati";
return response()->json([
'success' => true,
'message' => $pesan,
'stats' => compact('berhasil', 'duplikat', 'kosong')
]);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'message' => 'Gagal import: ' . $e->getMessage()
], 500);
}
}
public function downloadTemplateKamus()
{
$headers = ['Content-Type' => 'text/csv'];
$filename = 'template_kamus_normalisasi.csv';
$callback = function () {
$file = fopen('php://output', 'w');
fputcsv($file, ['kata_tidak_baku', 'kata_baku']); // header
fputcsv($file, ['dmkr', 'damkar']);
fputcsv($file, ['tdk', 'tidak']);
fputcsv($file, ['yg', 'yang']);
fclose($file);
};
return response()->stream($callback, 200, array_merge($headers, [
'Content-Disposition' => "attachment; filename={$filename}",
]));
}
}

View File

@ -0,0 +1,266 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\DatasetItem;
use Illuminate\Support\Facades\Http;
use App\Models\KamusNormalisasi;
class PreprocessingController extends Controller
{
public function index(Request $request)
{
$query = DatasetItem::query();
if ($request->has('search') && $request->search != '') {
$query->where('teks', 'like', '%' . $request->search . '%');
}
$datasetItems = $query->orderBy('tanggal', 'asc')->paginate(15);
$totalItems = DatasetItem::count();
$processedItems = DatasetItem::whereNotNull('teks_stemmed')->count();
return view('admin.preprocessing.index', compact(
'datasetItems',
'totalItems',
'processedItems'
));
}
public function filterAndCleanData(Request $request)
{
try {
$countAwal = \App\Models\DatasetItem::count();
$allData = \App\Models\DatasetItem::orderBy('id')->get(['id', 'teks']);
$uniqueCoreTexts = [];
$idsToDelete = [];
$noiseList = [
'tribun', 'tribunnews', 'kompas', 'antara', 'antaranews', 'liputan6', 'kumparan', 'sindonews', 'merdeka', 'viva', 'inews', 'tvone', 'jawapos', 'radar\b', 'jprk', 'jp\s+radar', 'reporter', 'redaksi', 'wartawan', 'press\s+release', 'rilis', 'jurnalis', 'kontributor', 'editor', 'news', 'berita', 'artikel', 'website',
'ujar\s+akun', 'ungkap\s+akun', 'tulis\s+akun', 'kata\s+kabid', 'kata\s+kepala', 'kata\s+pelaksana', 'menurut\s+informasi', 'menurut\s+warga', 'dalam\s+keterangannya', 'dimintai\s+konfirmasi', 'dikutip\s+dari', 'dilansir\s+dari', 'melansir', 'slide\s+liputan', 'liputan\s+on\s+tiktok', 'akun\s+instagram', 'lewat\s+dm\s+ke\s+akun',
'repost', 'source', 'sc:', 'cr:', '\bref\.', 'vid\.', '\bsumber\s*:', '\bfoto\s*:', '\bfoto\s+[a-z0-9_]+\s*/', 'sumber\s+foto', 'selengkapnya\s+bisa\s+dibaca', 'baca\s+selengkapnya', 'klik\s+link', 'dibio', 'di\s+bio', 'linimasa',
'feedgramindo', 'jangan\s+lupa\s+like', 'like\s+coment\s+share', 'like\s+comment\s+share', 'comment\s+share', 'coment\s+share', 'pengirim\s+stars\s+teratas', 'stars\s+teratas', 'biar\s+kite\s+makin\s+semangat',
'loker', 'lowongan', 'rekrutmen', 'pelamar', 'pendaftaran\s+petugas', 'sscasn',
'apel\s+pagi', 'apel\s+senin', 'apel\s+gabungan', 'simulasi\s+kebakaran',
'interview', 'gue\s+hr', 'suamik', 'paksu', 'tukar\s+kado', 'kebakaran\s+jenggot', 'anime', 'jual\s+beli', 'jual\s+seragam', 'sewakan\s+seragam', 'bioskop', 'wattpad', 'novel', 'fiksi', 'sobat\s+polri', 'minwas', 'pasal', 'outing', 'rapor', 'raport', 'ambil\s+rapor', 'mengambil\s+rapor', 'pengambilan\s+rapor', 'suami\s+idaman', 'kerja\s+sambil\s+dengar\s+musik', 'me\s+my\s+journey', 'tenangbis', 'ucok\s+core', 'nilai\s+sendiri', 'ada\s+ada\s+aja',
'horor', 'setan', 'makhluk\s+halus', 'ghoib', 'gaib', 'ritual', 'ruqyah', 'ular\s+gaib', 'kesurupan', 'menikahi', 'gadis\s+itu\s+berjanji',
'los\s+angeles', 'california', 'amerika\s+serikat', 'wildfire', 'prayfor', 'jepang', 'amerika', 'china', 'korea', 'luar\s+negeri', 'tragedipemadamkebakaranlosangles',
'inibalikpapanbosku', 'halo\b',
'perhatikan\s+setiap\s+langkahmu', 'terima\s+kasih\s+atas\s+semua\s+dukungannya', 'kb\s+tadzkiya', 'anak\s+happy', 'diajak\s+keliling\s+kota', 'keliling\s+kota\s+bangun\s+dg\s+mobil\s+damkar', 'pesawat\s+pemadam\s+kebakaran\s+la'
];
$noiseRegex = '#(' . implode('|', $noiseList) . ')#i';
foreach ($allData as $item) {
$text = strval($item->teks);
$splitTranslate = preg_split('/\|?\s*(translate|ai info)/i', $text);
$core = $splitTranslate[0];
$parts = explode('|', $core);
if (count($parts) > 2) {
$core = implode('|', array_slice($parts, 2));
}
$core = trim($core);
if (
in_array($core, $uniqueCoreTexts, true) ||
!preg_match('/\b(damkar|pemadam|kebakaran|gulkarmat|dpkp)\b/i', $text) ||
preg_match($noiseRegex, $text)
) {
$idsToDelete[] = $item->id;
} else {
$uniqueCoreTexts[] = $core;
}
}
// Hapus data secara bertahap
if (count($idsToDelete) > 0) {
foreach (array_chunk($idsToDelete, 1000) as $chunk) {
\App\Models\DatasetItem::whereIn('id', $chunk)->delete();
}
}
$datasets = \App\Models\Dataset::all();
foreach ($datasets as $dataset) {
$actualCount = \App\Models\DatasetItem::where('dataset_id', $dataset->id)->count();
$dataset->update(['total_rows' => $actualCount]);
}
$deletedTotal = count($idsToDelete);
if ($request->ajax() || $request->wantsJson()) {
return response()->json([
'success' => true,
'sampah' => $deletedTotal
]);
}
return back()
->with('success', 'Filtering Ekstrem Selesai!')
->with('irrelevant_terhapus', $deletedTotal);
} catch (\Exception $e) {
if ($request->ajax() || $request->wantsJson()) {
return response()->json(['success' => false, 'message' => $e->getMessage()], 500);
}
return back()->with('error', 'Gagal memfilter data: ' . $e->getMessage());
}
}
public function process()
{
$items = DatasetItem::whereNull('teks_stemmed')->take(50)->get();
if ($items->isEmpty()) {
return response()->json(['status' => 'completed']);
}
$kamus = KamusNormalisasi::pluck('kata_baku', 'kata_tidak_baku')->toArray();
$payload = [];
$dataUpdateLokal = [];
// Ambil histori seluruh case_folding unik dari database
$existingCleansed = DatasetItem::whereNotNull('teks_cleansed')->pluck('teks_cleansed')->toArray();
$lokalCleansedCheck = $existingCleansed;
$noiseList = [
'tribun', 'tribunnews', 'kompas', 'antara', 'antaranews', 'liputan6', 'kumparan', 'sindonews', 'merdeka', 'viva', 'inews', 'tvone', 'jawapos', 'radar\b', 'jprk', 'jp\s+radar', 'reporter', 'redaksi', 'wartawan', 'press\s+release', 'rilis', 'jurnalis', 'kontributor', 'editor', 'news', 'berita', 'artikel', 'website',
'ujar\s+akun', 'ungkap\s+akun', 'tulis\s+akun', 'kata\s+kabid', 'kata\s+kepala', 'kata\s+pelaksana', 'menurut\s+informasi', 'menurut\s+warga', 'dalam\s+keterangannya', 'dimintai\s+konfirmasi', 'dikutip\s+dari', 'dilansir\s+dari', 'melansir', 'slide\s+liputan', 'liputan\s+on\s+tiktok', 'akun\s+instagram', 'lewat\s+dm\s+ke\s+akun',
'repost', 'source', 'sc:', 'cr:', '\bref\.', 'vid\.', '\bsumber\s*:', '\bfoto\s*:', '\bfoto\s+[a-z0-9_]+\s*/', 'sumber\s+foto', 'selengkapnya\s+bisa\s+dibaca', 'baca\s+selengkapnya', 'klik\s+link', 'dibio', 'di\s+bio', 'linimasa',
'feedgramindo', 'jangan\s+lupa\s+like', 'like\s+coment\s+share', 'like\s+comment\s+share', 'comment\s+share', 'coment\s+share', 'pengirim\s+stars\s+teratas', 'stars\s+teratas', 'biar\s+kite\s+makin\s+semangat',
'loker', 'lowongan', 'rekrutmen', 'pelamar', 'pendaftaran\s+petugas', 'sscasn',
'apel\s+pagi', 'apel\s+senin', 'apel\s+gabungan', 'simulasi\s+kebakaran',
'interview', 'gue\s+hr', 'suamik', 'paksu', 'tukar\s+kado', 'kebakaran\s+jenggot', 'anime', 'jual\s+beli', 'jual\s+seragam', 'sewakan\s+seragam', 'bioskop', 'wattpad', 'novel', 'fiksi', 'sobat\s+polri', 'minwas', 'pasal', 'outing', 'rapor', 'raport', 'ambil\s+rapor', 'mengambil\s+rapor', 'pengambilan\s+rapor', 'suami\s+idaman', 'kerja\s+sambil\s+dengar\s+musik', 'me\s+my\s+journey', 'tenangbis', 'ucok\s+core', 'nilai\s+sendiri', 'ada\s+ada\s+aja',
'horor', 'setan', 'makhluk\s+halus', 'ghoib', 'gaib', 'ritual', 'ruqyah', 'ular\s+gaib', 'kesurupan', 'menikahi', 'gadis\s+itu\s+berjanji',
'los\s+angeles', 'california', 'amerika\s+serikat', 'wildfire', 'prayfor', 'jepang', 'amerika', 'china', 'korea', 'luar\s+negeri', 'tragedipemadamkebakaranlosangles',
'inibalikpapanbosku', 'halo\b',
'perhatikan\s+setiap\s+langkahmu', 'terima\s+kasih\s+atas\s+semua\s+dukungannya', 'kb\s+tadzkiya', 'anak\s+happy', 'diajak\s+keliling\s+kota', 'keliling\s+kota\s+bangun\s+dg\s+mobil\s+damkar', 'pesawat\s+pemadam\s+kebakaran\s+la'
];
$noiseRegex = '#(' . implode('|', $noiseList) . ')#i';
foreach ($items as $item) {
$text = strval($item->teks);
// Cleansing Dasar
$splitTranslate = preg_split('/\|?\s*(translate|ai info)/i', $text);
$text = $splitTranslate[0];
if (strpos($text, '|') !== false) {
$parts = explode('|', $text);
if (count($parts) > 2) {
$contentParts = array_slice($parts, 2);
$validParts = [];
foreach ($contentParts as $p) {
$pClean = trim($p);
if (preg_match('/^[\d\.,]+[KkMmBb]?$/i', $pClean)) continue;
if ($pClean === '.' || $pClean === '') continue;
$validParts[] = $pClean;
}
$text = implode(' ', $validParts);
}
}
$text = preg_replace('/\breplying to\b/i', '', $text);
$text = preg_replace('/@[\w_.]*damkar[\w_.]*/i', ' damkar ', $text);
$text = preg_replace('/@[A-Za-z0-9_.]+/i', '', $text);
$text = preg_replace('/#.*/', '', $text);
$text = preg_replace('/[🎥📸].*/u', '', $text);
$text = preg_replace('/(http\S+|www\S+|https\S+)/i', '', $text);
$text = preg_replace('/\b(video|vid|foto|poto|credit|credits|source|sumber|sc|cr)\s*[:\/]\s*.*/i', '', $text);
$text = preg_replace('/\b(ig|instagram|tiktok|youtube)\s*[:\/]\s*\S+.*/i', '', $text);
$text = preg_replace('/\b(report by|story ig|baca selengkapnya|selengkapnya|klik link|di bio|dibio)\b.*/i', '', $text);
$text = preg_replace('/\b\w+\.(go\.id|co\.id|ac\.id|or\.id|web\.id|com|id|net|org)(?:\/\S*)?.*/i', '', $text);
$text = preg_replace('/[^a-zA-Z\s]/', ' ', $text);
$teksCleansed = strtolower($text);
// Filtering Ekor Kalimat & Duplikat Bertingkat
$teksCleansed = preg_replace('/\b(sc|cr|source|sumber|credit|credits)\b.*$/i', '', $teksCleansed);
$teksCleansed = preg_replace('/\b(foto|poto)\s+(bpk|ibu|pak|by|dari|dok|dokumentasi|akun|ig|instagram|tiktok|youtube)?\b.*$/i', '', $teksCleansed);
$teksCleansed = trim(preg_replace('/\s+/', ' ', $teksCleansed));
//Cek Duplikat Array
if (in_array($teksCleansed, $lokalCleansedCheck, true)) {
DatasetItem::where('id', $item->id)->delete();
continue;
}
$lokalCleansedCheck[] = $teksCleansed;
// Cek Noise
if (preg_match($noiseRegex, $teksCleansed) || $teksCleansed === "") {
DatasetItem::where('id', $item->id)->delete();
continue;
}
//Pengecekan < 4 kata (spasi array)
$wordsArray = array_values(array_filter(explode(' ', $teksCleansed)));
$wordCount = count($wordsArray);
if ($wordCount < 4) {
DatasetItem::where('id', $item->id)->delete();
continue;
}
//memastikan mengandung kata kunci damkar di teks akhir
if (!preg_match('/\b(damkar|pemadam|kebakaran|gulkarmat|dpkp)\b/i', $teksCleansed)) {
DatasetItem::where('id', $item->id)->delete();
continue;
}
// Normalisasi
$tokenisasi = json_encode($wordsArray);
$normalizedWords = array_map(function ($word) use ($kamus) {
return $kamus[$word] ?? $word;
}, $wordsArray);
$teksNormalized = implode(' ', $normalizedWords);
$payload[] = [
'id' => $item->id,
'teks' => $teksNormalized
];
$dataUpdateLokal[$item->id] = [
'word_count' => $wordCount,
'teks_cleansed' => $teksCleansed,
'tokenisasi' => $tokenisasi,
'teks_normalized' => $teksNormalized
];
}
if (empty($payload)) {
return response()->json(['status' => 'processing', 'processed' => DatasetItem::whereNotNull('teks_stemmed')->count(), 'total' => DatasetItem::count()]);
}
try {
$flaskUrl = env('FLASK_API_URL', 'http://127.0.0.1:5000') . '/api/preprocess';
$response = Http::timeout(300)->post($flaskUrl, ['data' => $payload]);
if ($response->successful()) {
$results = $response->json('data');
foreach ($results as $res) {
$id = $res['id'];
DatasetItem::where('id', $id)->update([
'word_count' => $dataUpdateLokal[$id]['word_count'],
'teks_cleansed' => $dataUpdateLokal[$id]['teks_cleansed'],
'tokenisasi' => $dataUpdateLokal[$id]['tokenisasi'],
'teks_normalized' => $dataUpdateLokal[$id]['teks_normalized'],
'teks_stopword' => $res['teks_stopword'],
'teks_stemmed' => $res['teks_stemmed']
]);
}
$sisa = DatasetItem::whereNull('teks_stemmed')->count();
$total = DatasetItem::count();
$processed = $total - $sisa;
return response()->json(['status' => 'processing', 'processed' => $processed, 'total' => $total]);
}
return response()->json(['status' => 'error', 'message' => 'API Flask error.'], 500);
} catch (\Exception $e) {
return response()->json(['status' => 'error', 'message' => 'Gagal koneksi Flask: ' . $e->getMessage()], 500);
}
}
}

View File

@ -0,0 +1,111 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Dataset;
use App\Models\DatasetItem;
use Illuminate\Support\Facades\Storage;
use Maatwebsite\Excel\Facades\Excel;
use App\Exports\TemplateExport;
use PhpOffice\PhpSpreadsheet\Shared\Date;
class UploadController extends Controller
{
public function index()
{
$datasets = Dataset::latest()->get();
return view('admin.upfile.index', compact('datasets'));
}
public function process(Request $request)
{
$request->validate([
'file_dataset' => 'required|mimes:csv,xlsx,xls|max:10240',
'batch_name' => 'nullable|string|max:255',
]);
if ($request->hasFile('file_dataset')) {
$file = $request->file('file_dataset');
$fileName = time() . '_' . $file->getClientOriginalName();
$path = $file->storeAs('public/datasets', $fileName);
$dataArray = Excel::toArray([], $file);
$rows = $dataArray[0];
array_shift($rows);
$dataset = Dataset::create([
'file_name' => $file->getClientOriginalName(),
'batch_name' => $request->batch_name,
'file_path' => $path,
'total_rows' => count($rows),
'status' => 'Pending',
]);
foreach ($rows as $row) {
if (isset($row[2]) && trim($row[2]) !== '') {
$tanggal = null;
if (isset($row[1])) {
if (is_numeric($row[1])) {
try {
$tanggal = Date::excelToDateTimeObject($row[1])->format('Y-m-d');
} catch (\Throwable $e) {
$tanggal = null;
}
} else {
try {
$tanggal = \Carbon\Carbon::parse($row[1])->format('Y-m-d');
} catch (\Throwable $e) {
$tanggal = date('Y-m-d', strtotime($row[1]));
}
}
}
DatasetItem::create([
'dataset_id' => $dataset->id,
'keyword' => $row[0] ?? null,
'tanggal' => $tanggal,
'teks' => $row[2],
]);
}
}
$dataset->update([
'status' => 'Selesai Diproses'
]);
return redirect()->back()->with('success', 'Berhasil! Dataset telah diurai dan disimpan ke database.');
}
return redirect()->back()->with('error', 'Gagal memproses file.');
}
public function downloadTemplate()
{
return Excel::download(new TemplateExport, 'template_dasena.xlsx');
}
public function destroy($id)
{
try {
$dataset = Dataset::findOrFail($id);
if (Storage::exists($dataset->file_path)) {
Storage::delete($dataset->file_path);
}
DatasetItem::where('dataset_id', $dataset->id)->delete();
$dataset->delete();
return response()->json([
'success' => true,
'message' => 'Data beserta seluruh baris komentar berhasil dihapus.'
]);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'message' => 'Gagal menghapus: ' . $e->getMessage()
], 500);
}
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\User;
class UserManagementController extends Controller
{
public function index(Request $request)
{
$query = User::query();
if ($request->filled('search')) {
$query->where(function ($q) use ($request) {
$q->where('name', 'like', '%' . $request->search . '%')
->orWhere('email', 'like', '%' . $request->search . '%');
});
}
if ($request->filled('role')) {
$query->where('role', $request->role);
}
$users = $query->latest()->paginate(10);
$totalAdmin = User::where('role', 'admin')->count();
$totalUser = User::where('role', 'user')->count();
$total = User::count();
return view('admin.users.index', compact('users', 'totalAdmin', 'totalUser', 'total'));
}
public function updateRole(Request $request, $id)
{
$request->validate([
'role' => 'required|in:admin,user',
]);
$user = User::findOrFail($id);
if ($user->id === auth()->id()) {
return response()->json([
'success' => false,
'message' => 'Anda tidak dapat mengubah role akun Anda sendiri.'
], 403);
}
$user->update(['role' => $request->role]);
return response()->json([
'success' => true,
'message' => "Role {$user->name} berhasil diubah menjadi {$request->role}.",
'role' => $user->role
]);
}
public function destroy($id)
{
$user = User::findOrFail($id);
if ($user->id === auth()->id()) {
return response()->json([
'success' => false,
'message' => 'Anda tidak dapat menghapus akun Anda sendiri.'
], 403);
}
$user->delete();
return response()->json([
'success' => true,
'message' => "Akun {$user->name} berhasil dihapus."
]);
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
use Illuminate\Validation\ValidationException; // <-- 1. Tambahkan baris ini
class AuthenticatedSessionController extends Controller
{
/**
* Display the login view.
*/
public function create(): View
{
return view('auth.login');
}
/**
* Handle an incoming authentication request.
*/
public function store(LoginRequest $request)
{
try {
$request->authenticate();
} catch (ValidationException $e) {
return response()->json([
'status' => false,
'msg' => 'Email atau kata sandi yang Anda masukkan salah.'
]);
}
$request->session()->regenerate();
session([
'is_logged_in' => true
]);
return response()->json([
'status' => true,
'msg' => 'Login Berhasil!'
]);
}
/**
* Destroy an authenticated session.
*/
public function destroy(Request $request): RedirectResponse
{
Auth::guard('web')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/');
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
class ConfirmablePasswordController extends Controller
{
/**
* Show the confirm password view.
*/
public function show(): View
{
return view('auth.confirm-password');
}
/**
* Confirm the user's password.
*/
public function store(Request $request): RedirectResponse
{
if (! Auth::guard('web')->validate([
'email' => $request->user()->email,
'password' => $request->password,
])) {
throw ValidationException::withMessages([
'password' => __('auth.password'),
]);
}
$request->session()->put('auth.password_confirmed_at', time());
return redirect()->intended(route('dashboard', absolute: false));
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class EmailVerificationNotificationController extends Controller
{
/**
* Send a new email verification notification.
*/
public function store(Request $request): RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(route('dashboard', absolute: false));
}
$request->user()->sendEmailVerificationNotification();
return back()->with('status', 'verification-link-sent');
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
class EmailVerificationPromptController extends Controller
{
/**
* Display the email verification prompt.
*/
public function __invoke(Request $request): RedirectResponse|View
{
return $request->user()->hasVerifiedEmail()
? redirect()->intended(route('dashboard', absolute: false))
: view('auth.verify-email');
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules;
use Illuminate\View\View;
class NewPasswordController extends Controller
{
/**
* Display the password reset view.
*/
public function create(Request $request): View
{
return view('auth.reset-password', ['request' => $request]);
}
/**
* Handle an incoming new password request.
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request): RedirectResponse
{
$request->validate([
'token' => ['required'],
'email' => ['required', 'email'],
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$status = Password::reset(
$request->only('email', 'password', 'password_confirmation', 'token'),
function (User $user) use ($request) {
$user->forceFill([
'password' => Hash::make($request->password),
'remember_token' => Str::random(60),
])->save();
event(new PasswordReset($user));
}
);
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
// redirect them back to where they came from with their error message.
return $status == Password::PASSWORD_RESET
? redirect()->route('login')->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules\Password;
class PasswordController extends Controller
{
/**
* Update the user's password.
*/
public function update(Request $request): RedirectResponse
{
$validated = $request->validateWithBag('updatePassword', [
'current_password' => ['required', 'current_password'],
'password' => ['required', Password::defaults(), 'confirmed'],
]);
$request->user()->update([
'password' => Hash::make($validated['password']),
]);
return back()->with('status', 'password-updated');
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use Illuminate\View\View;
class PasswordResetLinkController extends Controller
{
/**
* Display the password reset link request view.
*/
public function create(): View
{
return view('auth.forgot-password');
}
/**
* Handle an incoming password reset link request.
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request): RedirectResponse
{
$request->validate([
'email' => ['required', 'email'],
]);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$status = Password::sendResetLink(
$request->only('email')
);
return $status == Password::RESET_LINK_SENT
? back()->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules;
use Illuminate\View\View;
class RegisteredUserController extends Controller
{
/**
* Display the registration view.
*/
public function create(): View
{
return view('auth.register');
}
/**
* Handle an incoming registration request.
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request): RedirectResponse
{
$request->validate([
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:' . User::class],
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
event(new Registered($user));
Auth::login($user);
return redirect(route('dashboard', absolute: false));
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Auth\Events\Verified;
use Illuminate\Foundation\Auth\EmailVerificationRequest;
use Illuminate\Http\RedirectResponse;
class VerifyEmailController extends Controller
{
/**
* Mark the authenticated user's email address as verified.
*/
public function __invoke(EmailVerificationRequest $request): RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
}
if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}

View File

@ -0,0 +1,37 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Laravel\Socialite\Facades\Socialite;
use App\Models\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
class GoogleAuthController extends Controller
{
public function redirect()
{
return Socialite::driver('google')->redirect();
}
public function callback()
{
try {
$googleUser = Socialite::driver('google')->user();
$user = User::updateOrCreate([
'email' => $googleUser->email,
], [
'name' => $googleUser->name,
'google_id' => $googleUser->id,
'password' => bcrypt(Str::random(16))
]);
Auth::login($user);
return redirect()->route('dashboard');
} catch (\Exception $e) {
return redirect('/login')->withErrors(['msg' => 'Terjadi kesalahan saat login dengan Google.']);
}
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\ContactMessage;
class LandingController extends Controller
{
public function storeContact(Request $request)
{
$request->validate([
'name' => 'required|string|max:255',
'email' => 'required|email|max:255',
'subject' => 'required|string|max:255',
'message' => 'required|string',
]);
ContactMessage::create($request->all());
if ($request->ajax() || $request->wantsJson()) {
return response()->json([
'success' => true,
'message' => 'Pesan Anda telah berhasil dikirim! Kami akan segera merespons.'
]);
}
return redirect()->back()->with('success', 'Pesan Anda telah berhasil dikirim! Kami akan segera merespons.');
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\ProfileUpdateRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect;
use Illuminate\View\View;
class ProfileController extends Controller
{
/**
* Display the user's profile form.
*/
public function edit(Request $request): View
{
return view('profile.edit', [
'user' => $request->user(),
]);
}
/**
* Update the user's profile information.
*/
public function update(ProfileUpdateRequest $request): RedirectResponse
{
$request->user()->fill($request->validated());
if ($request->user()->isDirty('email')) {
$request->user()->email_verified_at = null;
}
$request->user()->save();
return Redirect::route('profile.edit')->with('status', 'profile-updated');
}
/**
* Delete the user's account.
*/
public function destroy(Request $request): RedirectResponse
{
$request->validateWithBag('userDeletion', [
'password' => ['required', 'current_password'],
]);
$user = $request->user();
Auth::logout();
$user->delete();
$request->session()->invalidate();
$request->session()->regenerateToken();
return Redirect::to('/');
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\DatasetItem;
class DashboardController extends Controller
{
public function index()
{
if (auth()->check() && auth()->user()->role === 'admin') {
return redirect()->route('admin.dashboard');
}
$stats = [
'positif' => DatasetItem::where('sentimen', 'Positif')->count(),
'netral' => DatasetItem::where('sentimen', 'Netral')->count(),
'negatif' => DatasetItem::where('sentimen', 'Negatif')->count(),
'total' => DatasetItem::whereNotNull('sentimen')->count(),
];
$totalAllData = DatasetItem::count();
$trendData = DatasetItem::selectRaw('MONTH(tanggal) as bulan, sentimen, count(*) as jumlah')
->whereNotNull('sentimen')
->whereNotNull('tanggal')
->whereYear('tanggal', '2025')
->groupBy('bulan', 'sentimen')
->get();
$recentComments = DatasetItem::orderBy('tanggal', 'desc')->take(5)->get();
$getWordCloudData = function ($sentimen) {
$texts = DatasetItem::where('sentimen', $sentimen)->pluck('teks_stemmed')->toArray();
$wordCounts = [];
foreach ($texts as $text) {
$words = explode(' ', strtolower($text));
foreach ($words as $word) {
$word = trim($word);
if (strlen($word) > 2) {
if (!isset($wordCounts[$word])) {
$wordCounts[$word] = 0;
}
$wordCounts[$word]++;
}
}
}
arsort($wordCounts);
$topWords = array_slice($wordCounts, 0, 50);
$wordCloudData = [];
foreach ($topWords as $word => $count) {
$wordCloudData[] = ['x' => $word, 'value' => $count];
}
return $wordCloudData;
};
$wordCloudDataPositif = $getWordCloudData('Positif');
$wordCloudDataNetral = $getWordCloudData('Netral');
$wordCloudDataNegatif = $getWordCloudData('Negatif');
return view('user.dashboard.index', compact(
'stats',
'trendData',
'recentComments',
'totalAllData',
'wordCloudDataPositif',
'wordCloudDataNetral',
'wordCloudDataNegatif'
));
}
}

View File

@ -0,0 +1,196 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\DatasetItem;
use App\Models\GroundTruth; // PASTIKAN MODEL INI DIPANGGIL
use Maatwebsite\Excel\Facades\Excel;
use App\Exports\HasilAnalisisExport;
use Illuminate\Support\Facades\Http;
class HasilAnalisisController extends Controller
{
public function index(Request $request)
{
$query = DatasetItem::query()->whereNotNull('teks_stemmed');
if ($request->has('sentimen') && $request->sentimen != '') {
$query->where('sentimen', $request->sentimen);
}
if ($request->has('bulan') && $request->bulan != '') {
$query->whereMonth('tanggal', $request->bulan);
}
if ($request->has('search') && $request->search != '') {
$query->where(function ($q) use ($request) {
$q->where('teks_stemmed', 'like', '%' . $request->search . '%')
->orWhere('teks', 'like', '%' . $request->search . '%');
});
}
$stats = DatasetItem::selectRaw("
COUNT(CASE WHEN teks_stemmed IS NOT NULL THEN 1 END) as total_processed,
COUNT(CASE WHEN sentimen = 'Positif' THEN 1 END) as total_positif,
COUNT(CASE WHEN sentimen = 'Negatif' THEN 1 END) as total_negatif,
COUNT(CASE WHEN sentimen = 'Netral' THEN 1 END) as total_netral
")->first();
$totalProcessed = $stats->total_processed ?? 0;
$totalPositif = $stats->total_positif ?? 0;
$totalNegatif = $stats->total_negatif ?? 0;
$totalNetral = $stats->total_netral ?? 0;
$items = $query->orderBy('tanggal', 'asc')->paginate(15);
$bulanTersedia = DatasetItem::whereNotNull('teks_stemmed')
->whereNotNull('tanggal')
->selectRaw('MONTH(tanggal) as bulan')
->groupBy('bulan')
->orderBy('bulan', 'asc')
->pluck('bulan')
->toArray();
$namaBulan = [
1 => 'Januari',
2 => 'Februari',
3 => 'Maret',
4 => 'April',
5 => 'Mei',
6 => 'Juni',
7 => 'Juli',
8 => 'Agustus',
9 => 'September',
10 => 'Oktober',
11 => 'November',
12 => 'Desember'
];
return view('user.hasilanalisis.index', compact(
'items',
'totalProcessed',
'totalPositif',
'totalNegatif',
'totalNetral',
'bulanTersedia',
'namaBulan'
));
}
public function export()
{
return Excel::download(new HasilAnalisisExport, 'Data_Sentimen_Damkar.xlsx');
}
public function prediksiAuto()
{
set_time_limit(0);
$items = DatasetItem::whereNull('sentimen')->get();
if ($items->isEmpty()) {
return response()->json(['status' => 'info', 'message' => 'Semua data sudah memiliki sentimen!']);
}
$flaskUrl = env('FLASK_API_URL', 'http://127.0.0.1:5000');
$totalProcessed = 0;
$totalDariKunci = 0;
$totalDariAI = 0;
$groundTruths = GroundTruth::all();
$kamusKunci = [];
foreach ($groundTruths as $gt) {
if (!empty($gt->teks_cleansed)) {
$kamusKunci[strtolower(trim($gt->teks_cleansed))] = $gt->sentimen;
}
if (!empty($gt->teks_asli)) {
$kamusKunci[strtolower(trim($gt->teks_asli))] = $gt->sentimen;
}
}
$antreanAI = [];
foreach ($items as $item) {
$teksBersih = strtolower(trim($item->teks_cleansed ?? ''));
$teksAsli = strtolower(trim($item->teks ?? ''));
$jawabanDitemukan = null;
if (!empty($teksBersih) && isset($kamusKunci[$teksBersih])) {
$jawabanDitemukan = $kamusKunci[$teksBersih];
} elseif (!empty($teksAsli) && isset($kamusKunci[$teksAsli])) {
$jawabanDitemukan = $kamusKunci[$teksAsli];
}
if ($jawabanDitemukan) {
$updatePayload = ['sentimen' => ucfirst($jawabanDitemukan)];
if (empty($item->teks_stemmed)) {
$updatePayload['teks_stemmed'] = $item->teks_cleansed ?? $item->teks;
}
DatasetItem::where('id', $item->id)->update($updatePayload);
$totalDariKunci++;
$totalProcessed++;
} else {
$antreanAI[] = $item;
}
}
if (count($antreanAI) > 0) {
$chunks = array_chunk($antreanAI, 20);
try {
foreach ($chunks as $chunk) {
$payloadData = [];
foreach ($chunk as $item) {
$payloadData[] = [
'id' => $item->id,
'teks' => $item->teks
];
}
$response = Http::timeout(120)->post($flaskUrl . '/api/preprocess', [
'data' => $payloadData
]);
if ($response->failed()) {
return response()->json(['status' => 'error', 'message' => 'Gagal di tengah proses. Pastikan Flask menyala.']);
}
$hasil = $response->json();
if (isset($hasil['status']) && $hasil['status'] === 'success') {
foreach ($hasil['data'] as $res) {
DatasetItem::where('id', $res['id'])->update([
'teks_stemmed' => $res['teks_stemmed'],
'sentimen' => ucfirst($res['sentimen'])
]);
$totalDariAI++;
$totalProcessed++;
}
} else {
return response()->json(['status' => 'error', 'message' => 'Format balasan dari AI tidak dikenali.']);
}
}
} catch (\Exception $e) {
return response()->json(['status' => 'error', 'message' => 'Koneksi ke Flask API terputus (Timeout): ' . $e->getMessage()]);
}
}
$pesan = "Analisis selesai! $totalProcessed komentar diproses.";
if ($totalDariKunci > 0 && $totalDariAI > 0) {
$pesan = "Selesai! $totalDariKunci dari Kunci Laporan, dan $totalDariAI diprediksi mandiri oleh Model.";
} elseif ($totalDariKunci > 0) {
$pesan = "Selesai! $totalDariKunci data berhasil disinkronkan dengan data Validator.";
} elseif ($totalDariAI > 0) {
$pesan = "Selesai! $totalDariAI data baru berhasil diprediksi oleh Model Naive Bayes.";
}
return response()->json([
'status' => 'success',
'message' => $pesan
]);
}
}

View File

@ -0,0 +1,70 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class UjiKlasifikasiController extends Controller
{
public function index()
{
return view('user.ujiklasifikasi.index');
}
public function analisis(Request $request)
{
$request->validate([
'teks' => 'required|string|min:3|max:1000',
], [
'teks.required' => 'Teks tidak boleh kosong.',
'teks.min' => 'Teks terlalu pendek, minimal 3 karakter.',
'teks.max' => 'Teks terlalu panjang, maksimal 1000 karakter.',
]);
try {
$flaskUrl = env('FLASK_API_URL', 'http://127.0.0.1:5000');
$response = Http::timeout(30)->post($flaskUrl . '/api/preprocess', [
'data' => [
[
'id' => 1,
'teks' => $request->teks,
]
]
]);
if ($response->failed()) {
return response()->json([
'success' => false,
'message' => 'Model AI tidak dapat dihubungi. Pastikan server Flask sedang berjalan.',
], 503);
}
$hasil = $response->json();
if (isset($hasil['status']) && $hasil['status'] === 'success' && !empty($hasil['data'])) {
$dataPrediksi = $hasil['data'][0];
return response()->json([
'success' => true,
'sentimen' => ucfirst($dataPrediksi['sentimen']),
'teks_stemmed' => $dataPrediksi['teks_stemmed'],
'confidences' => $dataPrediksi['confidences'] ?? ['Positif' => 0, 'Netral' => 0, 'Negatif' => 0]
]);
}
return response()->json([
'success' => false,
'message' => 'Gagal memproses data di AI.',
], 500);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'message' => 'Koneksi ke Flask API gagal: ' . $e->getMessage(),
], 503);
}
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class IsAdmin
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if (auth()->check()) {
if (auth()->user()->role === 'admin') {
return $next($request);
}
return redirect()->route(dashboard)->with('error', 'Akses Ditolak! Anda tidak memiliki izin untuk membuka halaman sistem.');
}
return redirect()->route(login);
}
}

View File

@ -0,0 +1,85 @@
<?php
namespace App\Http\Requests\Auth;
use Illuminate\Auth\Events\Lockout;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
class LoginRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'email' => ['required', 'string', 'email'],
'password' => ['required', 'string'],
];
}
/**
* Attempt to authenticate the request's credentials.
*
* @throws \Illuminate\Validation\ValidationException
*/
public function authenticate(): void
{
$this->ensureIsNotRateLimited();
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.failed'),
]);
}
RateLimiter::clear($this->throttleKey());
}
/**
* Ensure the login request is not rate limited.
*
* @throws \Illuminate\Validation\ValidationException
*/
public function ensureIsNotRateLimited(): void
{
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
return;
}
event(new Lockout($this));
$seconds = RateLimiter::availableIn($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.throttle', [
'seconds' => $seconds,
'minutes' => ceil($seconds / 60),
]),
]);
}
/**
* Get the rate limiting throttle key for the request.
*/
public function throttleKey(): string
{
return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip());
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use App\Models\User;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ProfileUpdateRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'email' => [
'required',
'string',
'lowercase',
'email',
'max:255',
Rule::unique(User::class)->ignore($this->user()->id),
],
];
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ContactMessage extends Model
{
protected $fillable = [
'name',
'email',
'subject',
'message',
'is_read',
'is_replied',
'reply_text'
];
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Dataset extends Model
{
protected $fillable = ['file_name', 'batch_name', 'file_path', 'total_rows', 'status'];
public function items(): HasMany
{
return $this->hasMany(DatasetItem::class);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class DatasetItem extends Model
{
protected $fillable = [
'dataset_id',
'keyword',
'tanggal',
'teks',
'teks_cleansed',
'teks_stopword',
'teks_stemmed',
'sentimen',
];
public function dataset(): BelongsTo
{
return $this->belongsTo(Dataset::class);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class GroundTruth extends Model
{
use HasFactory;
protected $guarded = ['id'];
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class KamusNormalisasi extends Model
{
use HasFactory;
protected $fillable = [
'kata_tidak_baku',
'kata_baku'
];
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
'google_id',
'role',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Auth\Notifications\ResetPassword;
use Illuminate\Notifications\Messages\MailMessage;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
//
}
public function boot(): void
{
ResetPassword::toMailUsing(function (object $notifiable, string $token) {
$url = url(route('password.reset', [
'token' => $token,
'email' => $notifiable->getEmailForPasswordReset(),
], false));
return (new MailMessage)
->subject('Permintaan Reset Kata Sandi - Dasena')
->view('emails.reset-password', [
'url' => $url,
'user' => $notifiable
]);
});
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use Illuminate\View\View;
class AppLayout extends Component
{
/**
* Get the view / contents that represents the component.
*/
public function render(): View
{
return view('layouts.app');
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use Illuminate\View\View;
class GuestLayout extends Component
{
/**
* Get the view / contents that represents the component.
*/
public function render(): View
{
return view('layouts.guest');
}
}

18
dasena-web/artisan Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
use Illuminate\Foundation\Application;
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
/** @var Application $app */
$app = require_once __DIR__.'/bootstrap/app.php';
$status = $app->handleCommand(new ArgvInput);
exit($status);

View File

@ -0,0 +1,21 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use App\Http\Middleware\IsAdmin;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__ . '/../routes/web.php',
commands: __DIR__ . '/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
$middleware->alias([
'is_admin' => IsAdmin::class
]);
})
->withExceptions(function (Exceptions $exceptions): void {
//
})->create();

2
dasena-web/bootstrap/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -0,0 +1,5 @@
<?php
return [
App\Providers\AppServiceProvider::class,
];

89
dasena-web/composer.json Normal file
View File

@ -0,0 +1,89 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.2",
"laravel/framework": "^12.0",
"laravel/socialite": "^5.26",
"laravel/tinker": "^2.10.1",
"maatwebsite/excel": "^3.1"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/breeze": "^2.3",
"laravel/pail": "^1.2.2",
"laravel/pint": "^1.24",
"laravel/sail": "^1.41",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"phpunit/phpunit": "^11.5.3"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"setup": [
"composer install",
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
"@php artisan key:generate",
"@php artisan migrate --force",
"npm install",
"npm run build"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
],
"test": [
"@php artisan config:clear --ansi",
"@php artisan test"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"pre-package-uninstall": [
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

9496
dasena-web/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

126
dasena-web/config/app.php Normal file
View File

@ -0,0 +1,126 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => 'Asia/Jakarta',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
];

115
dasena-web/config/auth.php Normal file
View File

@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', App\Models\User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 5,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the number of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];

117
dasena-web/config/cache.php Normal file
View File

@ -0,0 +1,117 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_STORE', 'database'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane",
| "failover", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
'failover' => [
'driver' => 'failover',
'stores' => [
'database',
'array',
],
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
];

View File

@ -0,0 +1,183 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
'transaction_mode' => 'DEFERRED',
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
'persistent' => env('REDIS_PERSISTENT', false),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
],
];

View File

@ -0,0 +1,80 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

View File

@ -0,0 +1,132 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'handler_with' => [
'stream' => 'php://stderr',
],
'formatter' => env('LOG_STDERR_FORMATTER'),
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

118
dasena-web/config/mail.php Normal file
View File

@ -0,0 +1,118 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
'retry_after' => 60,
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
'retry_after' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
];

125
dasena-web/config/queue.php Normal file
View File

@ -0,0 +1,125 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis",
| "deferred", "failover", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
'deferred' => [
'driver' => 'deferred',
],
'failover' => [
'driver' => 'failover',
'connections' => [
'database',
'deferred',
],
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];

View File

@ -0,0 +1,47 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'resend' => [
'key' => env('RESEND_KEY'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
'google' => [
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
'redirect' => env('GOOGLE_REDIRECT_URI'),
],
'flask' => [
'url' => env('FLASK_API_URL', 'http://localhost:5000'),
],
];

View File

@ -0,0 +1,217 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "memcached",
| "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain and all subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
];

1
dasena-web/database/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('google_id')->nullable()->after('email');
$table->string('password')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
//
});
}
};

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('datasets', function (Blueprint $table) {
$table->id();
$table->string('file_name');
$table->string('batch_name')->nullable();
$table->string('file_path');
$table->integer('total_rows')->default(0);
$table->enum('status', ['Pending', 'Processing', 'Selesai Diproses'])->default('Pending');
$table->timestamps(); // created_at = Tanggal Unggah
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('datasets');
}
};

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('dataset_items', function (Blueprint $table) {
$table->id();
$table->foreignId('dataset_id')->constrained('datasets')->onDelete('cascade');
$table->string('keyword')->nullable();
$table->date('tanggal')->nullable();
$table->text('teks');
$table->text('teks_cleansed')->nullable();
$table->text('teks_stopword')->nullable();
$table->text('teks_stemmed')->nullable();
$table->enum('sentimen', ['Positif', 'Netral', 'Negatif'])->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('dataset_items');
}
};

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->enum('role', ['admin', 'user'])->default('user')->after('email');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('role');
});
}
};

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('dataset_items', function (Blueprint $table) {
$table->dropForeign(['dataset_id']);
$table->foreign('dataset_id')
->references('id')
->on('datasets')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
schema::table('dataset_items', function (Blueprint $table) {
$table->dropForeign(['dataset_id']);
$table->foreign('dataset_id')
->references('id')
->on('datasets');
});
}
};

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('kamus_normalisasis', function (Blueprint $table) {
$table->id();
$table->string('kata_tidak_baku')->unique();
$table->string('kata_baku');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('kamus_normalisasis');
}
};

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('contact_messages', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email');
$table->string('subject');
$table->text('message');
$table->boolean('is_read')->default(false);
$table->boolean('is_replied')->default(false);
$table->text('reply_text')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('contact_messages');
}
};

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('dataset_items', function (Blueprint $table) {
$table->text('teks_normalized')->nullable()->after('teks_cleansed');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('dataset_items', function (Blueprint $table) {
$table->dropColumn('teks_normalized');
});
}
};

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('dataset_items', function (Blueprint $table) {
$table->unsignedInteger('word_count')->nullable()->after('teks');
$table->text('tokenisasi')->nullable()->after('teks_cleansed');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('dataset_items', function (Blueprint $table) {
$table->dropColumn(['word_count', 'tokenisasi']);
});
}
};

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ground_truths', function (Blueprint $table) {
$table->id();
$table->text('teks_asli')->nullable();
$table->text('teks_cleansed');
$table->enum('sentimen', ['Positif', 'Netral', 'Negatif']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ground_truths');
}
};

View File

@ -0,0 +1,25 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
use WithoutModelEvents;
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
]);
}
}

3486
dasena-web/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

21
dasena-web/package.json Normal file
View File

@ -0,0 +1,21 @@
{
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/vite": "^4.0.0",
"alpinejs": "^3.4.2",
"autoprefixer": "^10.4.23",
"axios": "^1.11.0",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^2.0.0",
"postcss": "^8.4.31",
"tailwindcss": "^3.1.0",
"vite": "^7.0.7"
}
}

35
dasena-web/phpunit.xml Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="BROADCAST_CONNECTION" value="null"/>
<env name="CACHE_STORE" value="array"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="TELESCOPE_ENABLED" value="false"/>
<env name="NIGHTWATCH_ENABLED" value="false"/>
</php>
</phpunit>

View File

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

View File

@ -0,0 +1,25 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Handle X-XSRF-Token Header
RewriteCond %{HTTP:x-xsrf-token} .
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1280">
<rect width="1280" height="1280" fill="#cccccc"></rect>
<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="monospace" font-size="26px" fill="#333333">1280x1280</text>
</svg>

After

Width:  |  Height:  |  Size: 281 B

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1280">
<rect width="1280" height="1280" fill="#cccccc"></rect>
<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="monospace" font-size="26px" fill="#333333">1280x1280</text>
</svg>

After

Width:  |  Height:  |  Size: 281 B

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1280">
<rect width="1280" height="1280" fill="#cccccc"></rect>
<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="monospace" font-size="26px" fill="#333333">1280x1280</text>
</svg>

After

Width:  |  Height:  |  Size: 281 B

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1280">
<rect width="1280" height="1280" fill="#cccccc"></rect>
<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="monospace" font-size="26px" fill="#333333">1280x1280</text>
</svg>

After

Width:  |  Height:  |  Size: 281 B

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1280">
<rect width="1280" height="1280" fill="#cccccc"></rect>
<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="monospace" font-size="26px" fill="#333333">1280x1280</text>
</svg>

After

Width:  |  Height:  |  Size: 281 B

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1280">
<rect width="1280" height="1280" fill="#cccccc"></rect>
<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="monospace" font-size="26px" fill="#333333">1280x1280</text>
</svg>

After

Width:  |  Height:  |  Size: 281 B

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1280">
<rect width="1280" height="1280" fill="#cccccc"></rect>
<text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="monospace" font-size="26px" fill="#333333">1280x1280</text>
</svg>

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Some files were not shown because too many files have changed in this diff Show More