chore: sync repository snapshot

This commit is contained in:
GuavaPopper
2026-06-11 14:53:35 +07:00
parent 529d8bcc70
commit 3bed7457ec
88 changed files with 13102 additions and 152 deletions
+7
View File
@@ -0,0 +1,7 @@
.git
.env
vendor
node_modules
database/database.sqlite
storage/logs/*.log
_legacy_original
+18
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 -4
View File
@@ -1,4 +1,65 @@
DB_HOST=127.0.0.1
DB_NAME=spbu_baru
DB_USER=root
DB_PASS=
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:bbAu4UCnpFwzL94x76uGNxESotpfaRJDOBEu88XZQug=
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}"
+65 -4
View File
@@ -1,4 +1,65 @@
DB_HOST=localhost
DB_NAME=spbu_baru
DB_USER=root
DB_PASS=
APP_NAME="WebGIS SPBU"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost:8000
APP_LOCALE=id
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=id_ID
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=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=spbu_baru
DB_USERNAME=root
DB_PASSWORD=
SESSION_DRIVER=file
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
CACHE_STORE=file
# 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
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
+23 -7
View File
@@ -1,8 +1,24 @@
# OS/editor files
.DS_Store
Thumbs.db
.vscode/
.idea/
# Logs
*.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
+19
View File
@@ -0,0 +1,19 @@
FROM php:8.3-cli
RUN apt-get update \
&& apt-get install -y --no-install-recommends git unzip libzip-dev \
&& docker-php-ext-install pdo_mysql zip \
&& rm -rf /var/lib/apt/lists/*
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
WORKDIR /app
COPY . .
RUN composer install --no-interaction --no-progress --optimize-autoloader \
&& chmod +x docker/entrypoint.sh
EXPOSE 8000
ENTRYPOINT ["docker/entrypoint.sh"]
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"]
+53 -95
View File
@@ -1,128 +1,86 @@
# WebGIS SPBU
# WebGIS SPBU Laravel
WebGIS SPBU adalah aplikasi Sistem Informasi Geografis sederhana untuk memetakan dan mengelola titik Stasiun Pengisian Bahan Bakar Umum (SPBU). Aplikasi ini memakai Leaflet untuk peta interaktif, PHP untuk API, dan MySQL/MariaDB untuk penyimpanan data.
WebGIS SPBU adalah aplikasi Laravel untuk memetakan dan mengelola titik Stasiun Pengisian Bahan Bakar Umum (SPBU). Aplikasi ini mempertahankan tampilan Leaflet, Tailwind CDN, DaisyUI CDN, dan Font Awesome dari versi HTML/PHP lama, tetapi backend-nya sudah memakai route, controller, model, migration, dan seeder Laravel.
## Fitur
- Menampilkan peta interaktif dengan pilihan layer peta standar dan satelit.
- Menambah data SPBU dengan klik lokasi langsung di peta.
- Mengedit data SPBU dan memindahkan marker dengan drag.
- Menghapus data SPBU dari halaman input maupun halaman daftar data.
- Menampilkan daftar SPBU, statistik total, statistik status operasional, pencarian, dan mini map sebaran.
- Mengelompokkan marker berdasarkan status `Buka 24 Jam` dan `Tidak Buka 24 Jam`.
- Landing page dengan peta latar.
- Input SPBU dari klik peta.
- Edit atribut SPBU.
- Drag marker untuk memindahkan lokasi.
- Hapus data SPBU.
- Halaman daftar data, statistik, pencarian, quick list, dan mini map.
## Teknologi
## Menjalankan Dengan Docker
- HTML, CSS, JavaScript
- PHP PDO
- MySQL atau MariaDB
- Leaflet
- Tailwind CSS CDN
- DaisyUI CDN
- Font Awesome CDN
```powershell
docker compose up --build
```
## Struktur Project
Buka:
```text
.
|-- api/
| |-- config.php
| |-- delete_spbu.php
| |-- get_spbu.php
| |-- save_spbu.php
| `-- update_spbu.php
|-- database/
| `-- schema.sql
|-- pages/
| |-- input.html
| `-- showdata.html
|-- .env.example
|-- index.html
`-- README.md
http://localhost:8000
```
## Prasyarat
Container `app` akan otomatis:
- Web server lokal seperti Laragon, XAMPP, atau Apache/Nginx dengan PHP.
- PHP dengan ekstensi PDO MySQL aktif.
- MySQL atau MariaDB.
- Koneksi internet untuk memuat library CDN dan tile map.
- membuat `.env` dari `.env.example` jika belum ada
- menyinkronkan konfigurasi dari `docker-compose.yml` ke `.env`
- generate `APP_KEY` jika belum tersedia
- menunggu MySQL siap
- menjalankan migration
- menjalankan seeder
- menjalankan Laravel di port `8000`
## Instalasi
Database MySQL berjalan di service `db` dengan volume `spbu-mysql-data`.
1. Clone repository ini ke direktori web server lokal.
## Menjalankan Lokal Tanpa Docker
```bash
git clone https://github.com/GuavaPopper/WebGIS_SPBU.git
Pastikan PHP 8.3, Composer, dan MySQL aktif.
```powershell
composer install
Copy-Item .env.example .env
php artisan key:generate
```
2. Masuk ke folder project.
```bash
cd WebGIS_SPBU
```
3. Buat database dan tabel dengan menjalankan script:
Buat database MySQL:
```sql
database/schema.sql
CREATE DATABASE spbu_baru CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
```
Script tersebut akan membuat database `spbu_baru`, tabel `spbu`, dan contoh data awal.
Sesuaikan `.env` jika user/password MySQL berbeda, lalu jalankan:
4. Salin file `.env.example` menjadi `.env`.
```bash
cp .env.example .env
```powershell
php artisan migrate --seed
php artisan serve --host=127.0.0.1 --port=8000
```
5. Sesuaikan konfigurasi database di file `.env`.
```env
DB_HOST=localhost
DB_NAME=spbu_baru
DB_USER=root
DB_PASS=
```
6. Jalankan project melalui web server lokal, misalnya:
```text
http://localhost/SPBU_Enhanced/
```
## Halaman Aplikasi
- `index.html`: halaman awal dan peta latar.
- `pages/input.html`: halaman input, edit, hapus, dan pemindahan titik SPBU.
- `pages/showdata.html`: halaman daftar data, statistik, pencarian, dan mini map.
Buka `http://127.0.0.1:8000`.
## Endpoint API
| Endpoint | Method | Fungsi |
| Method | Endpoint | Fungsi |
| --- | --- | --- |
| `api/get_spbu.php` | `GET` | Mengambil semua data SPBU |
| `api/save_spbu.php` | `POST` | Menyimpan data SPBU baru |
| `api/update_spbu.php` | `POST` atau `PUT` | Memperbarui data SPBU |
| `api/delete_spbu.php` | `DELETE` atau `POST` dengan `_method=DELETE` | Menghapus data SPBU |
| `GET` | `/api/spbu` | Mengambil semua data SPBU |
| `POST` | `/api/spbu` | Menyimpan data SPBU baru |
| `PUT` | `/api/spbu/{id}` | Memperbarui data SPBU |
| `DELETE` | `/api/spbu/{id}` | Menghapus data SPBU |
## Format Data SPBU
## Halaman
```json
{
"nama_spbu": "SPBU Jl. Ahmad Yani",
"nomor_spbu": "64.751.01",
"status": "Buka 24 Jam",
"latitude": -0.0600366,
"longitude": 109.3458023
}
- `/` - landing page
- `/input` - input, edit, hapus, dan pindah marker
- `/data` - daftar data, statistik, search, quick list, dan mini map
## Testing
```powershell
php artisan test
```
Nilai `status` yang valid:
## Catatan Migrasi
- `Buka 24 Jam`
- `Tidak Buka 24 Jam`
## Catatan Konfigurasi
File `.env` ikut disertakan untuk kebutuhan setup repository private. Jika project dipindahkan ke environment lain, sesuaikan nilai database di `.env` atau gunakan `.env.example` sebagai template konfigurasi.
Source versi lama disimpan di folder `_legacy_original` untuk referensi. Folder itu tidak ikut masuk ke Docker image.
+6
View File
@@ -0,0 +1,6 @@
.git
.gitignore
.gitattributes
.env
*.md
docker-compose.yml
+4
View File
@@ -0,0 +1,4 @@
DB_HOST=localhost
DB_NAME=spbu_baru
DB_USER=root
DB_PASS=
+2
View File
@@ -0,0 +1,2 @@
* text=auto
*.sh text eol=lf
+11
View File
@@ -0,0 +1,11 @@
# OS/editor files
.DS_Store
Thumbs.db
.vscode/
.idea/
# Logs
*.log
# Environment (kredensial — jangan pernah di-commit)
.env
+25
View File
@@ -0,0 +1,25 @@
# WebGIS SPBU — vanilla PHP + HTML statis (tanpa Composer/npm, tanpa build step),
# jadi cukup single-stage (multi-stage di coolify-deployment.md Aturan #5 tidak
# relevan untuk project ini).
#
# Coolify: deploy sebagai Application dengan Dockerfile buildpack, lalu isi
# Ports Exposes = 8000 secara manual (Aturan #3 — EXPOSE di bawah tidak dibaca).
FROM php:8.3-cli
RUN docker-php-ext-install pdo_mysql \
&& mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
WORKDIR /app
COPY . .
# Normalisasi CRLF→LF untuk jaga-jaga kalau repo ter-checkout dengan CRLF.
RUN sed -i 's/\r$//' docker/entrypoint.sh \
&& chmod +x docker/entrypoint.sh
# Concurrency untuk PHP built-in server (default-nya single process).
ENV PHP_CLI_SERVER_WORKERS=8
EXPOSE 8000
ENTRYPOINT ["/app/docker/entrypoint.sh"]
CMD ["php", "-S", "0.0.0.0:8000", "-t", "/app"]
+27
View File
@@ -0,0 +1,27 @@
<?php
// ── SHARED DATABASE CONFIGURATION ───────────────────────────────────────────
// Digunakan oleh semua endpoint API. Kredensial di-resolve lewat api/env.php:
// env var asli (Coolify/Docker) menang atas file .env, dan .env opsional.
require_once __DIR__ . '/env.php';
$db = dbConfig();
// ── KONEKSI PDO ───────────────────────────────────────────────────────────────
try {
$pdo = new PDO(
"mysql:host={$db['host']};port={$db['port']};dbname={$db['dbname']};charset=utf8mb4",
$db['username'],
$db['password'],
[
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
]
);
} catch (PDOException $e) {
http_response_code(500);
header('Content-Type: application/json');
echo json_encode(['success' => false, 'message' => 'Koneksi database gagal: ' . $e->getMessage()]);
exit();
}
+56
View File
@@ -0,0 +1,56 @@
<?php
// ── RESOLUSI ENVIRONMENT VARIABLE ────────────────────────────────────────────
// Dipakai oleh api/config.php dan docker/init-db.php. Prioritas nilai mengikuti
// perilaku Coolify (lihat coolify-deployment.md Aturan #1):
// env var asli (Coolify/Docker) > file .env di root project > default.
// File .env opsional — di dalam container memang tidak ada.
function loadEnvFile(string $path): array
{
if (!is_file($path)) {
return [];
}
$vars = [];
foreach (file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
if (str_starts_with(trim($line), '#') || !str_contains($line, '=')) continue;
[$key, $value] = explode('=', $line, 2);
$vars[trim($key)] = trim($value);
}
return $vars;
}
function env(string $key): ?string
{
static $fileVars = null;
if ($fileVars === null) {
$fileVars = loadEnvFile(__DIR__ . '/../.env');
}
$real = getenv($key);
if ($real !== false && $real !== '') {
return $real;
}
return ($fileVars[$key] ?? '') !== '' ? $fileVars[$key] : null;
}
// Nama variabel project ini (DB_NAME/DB_USER/DB_PASS) maupun alias gaya Laravel
// (DB_DATABASE/DB_USERNAME/DB_PASSWORD) sama-sama diterima — lihat Aturan #2.
function dbConfig(): array
{
$envAny = function (array $keys, string $default): string {
foreach ($keys as $key) {
$value = env($key);
if ($value !== null) return $value;
}
return $default;
};
return [
'host' => $envAny(['DB_HOST'], 'localhost'),
'port' => $envAny(['DB_PORT'], '3306'),
'dbname' => $envAny(['DB_NAME', 'DB_DATABASE'], ''),
'username' => $envAny(['DB_USER', 'DB_USERNAME'], 'root'),
'password' => $envAny(['DB_PASS', 'DB_PASSWORD'], ''),
];
}
+29
View File
@@ -0,0 +1,29 @@
# Verifikasi lokal sebelum push ke Coolify. Topologi meniru Coolify persis:
# MySQL terpisah dengan database `default` + user non-root `mysql` (sekaligus
# menguji bahwa init-db tidak butuh privilege CREATE DATABASE).
services:
app:
build: .
ports:
- "8000:8000"
environment:
DB_HOST: db
DB_PORT: "3306"
DB_NAME: default
DB_USER: mysql
DB_PASS: secret
depends_on:
- db
db:
image: mysql:8.0
environment:
MYSQL_DATABASE: default
MYSQL_USER: mysql
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: rootsecret
volumes:
- db-data:/var/lib/mysql
volumes:
db-data:
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
set -e
php /app/docker/init-db.php
exec "$@"
+62
View File
@@ -0,0 +1,62 @@
<?php
// ── INIT DATABASE (dijalankan entrypoint pada SETIAP container start) ────────
// Pengganti "migrate + seed" dari coolify-deployment.md Aturan #6:
// 1. Tunggu database siap (retry ±60 detik).
// 2. Kalau tabel `spbu` sudah ada → skip, supaya idempoten antar restart
// (INSERT seed di schema.sql tidak boleh jalan dua kali).
// 3. Kalau belum → eksekusi database/schema.sql, dengan melewati statement
// CREATE DATABASE/USE — database sudah disediakan Coolify dan user
// aplikasi tidak punya privilege CREATE DATABASE.
require __DIR__ . '/../api/env.php';
$db = dbConfig();
$dsn = "mysql:host={$db['host']};port={$db['port']};dbname={$db['dbname']};charset=utf8mb4";
echo "Waiting for database at {$db['host']}:{$db['port']}...\n";
$pdo = null;
$maxAttempts = 30;
for ($attempt = 1; $attempt <= $maxAttempts; $attempt++) {
try {
$pdo = new PDO($dsn, $db['username'], $db['password'], [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_TIMEOUT => 3,
]);
break;
} catch (PDOException $e) {
if ($attempt === $maxAttempts) {
fwrite(STDERR, "Database {$db['host']}:{$db['port']} unreachable after {$maxAttempts} attempts: {$e->getMessage()}\n");
exit(1);
}
sleep(2);
}
}
echo "Database connection OK.\n";
if ($pdo->query("SHOW TABLES LIKE 'spbu'")->fetch() !== false) {
echo "Table 'spbu' already exists, skipping schema init.\n";
exit(0);
}
echo "Initializing schema from database/schema.sql...\n";
$sql = file_get_contents(__DIR__ . '/../database/schema.sql');
// Buang baris komentar penuh supaya pemecahan per `;` tetap aman.
$lines = array_filter(
explode("\n", $sql),
fn ($line) => !str_starts_with(trim($line), '--')
);
$statements = array_filter(array_map('trim', explode(';', implode("\n", $lines))));
foreach ($statements as $statement) {
if (preg_match('/^(CREATE\s+DATABASE|USE)\b/i', $statement)) {
continue;
}
$pdo->exec($statement);
}
echo "Schema initialized: table 'spbu' created and seeded.\n";
-38
View File
@@ -1,38 +0,0 @@
<?php
// ── SHARED DATABASE CONFIGURATION ───────────────────────────────────────────
// Digunakan oleh semua endpoint API. File .env berada di root project (satu
// level di atas folder api/).
$envFile = __DIR__ . '/../.env';
if (!file_exists($envFile)) {
http_response_code(500);
header('Content-Type: application/json');
echo json_encode(['success' => false, 'message' => 'File .env tidak ditemukan']);
exit();
}
foreach (file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
if (str_starts_with(trim($line), '#') || !str_contains($line, '=')) continue;
[$key, $value] = explode('=', $line, 2);
$_ENV[trim($key)] = trim($value);
}
$host = $_ENV['DB_HOST'] ?? 'localhost';
$dbname = $_ENV['DB_NAME'] ?? '';
$username = $_ENV['DB_USER'] ?? 'root';
$password = $_ENV['DB_PASS'] ?? '';
// ── KONEKSI PDO ───────────────────────────────────────────────────────────────
try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $username, $password, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
]);
} catch (PDOException $e) {
http_response_code(500);
header('Content-Type: application/json');
echo json_encode(['success' => false, 'message' => 'Koneksi database gagal: ' . $e->getMessage()]);
exit();
}
+8
View File
@@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}
+99
View File
@@ -0,0 +1,99 @@
<?php
namespace App\Http\Controllers;
use App\Models\Spbu;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
class SpbuController extends Controller
{
public function index(): JsonResponse
{
return response()->json(
Spbu::query()->orderByDesc('created_at')->get()
);
}
public function store(Request $request): JsonResponse
{
$validator = $this->validator($request);
if ($validator->fails()) {
return $this->validationError($validator);
}
$spbu = Spbu::create([
...$validator->validated(),
'created_at' => now(),
]);
return response()->json([
'success' => true,
'message' => 'Data SPBU berhasil disimpan',
'id' => $spbu->id,
], 201);
}
public function update(Request $request, Spbu $spbu): JsonResponse
{
$validator = $this->validator($request);
if ($validator->fails()) {
return $this->validationError($validator);
}
$spbu->update($validator->validated());
return response()->json([
'success' => true,
'message' => 'Data SPBU berhasil diperbarui',
]);
}
public function destroy(Spbu $spbu): JsonResponse
{
$spbu->delete();
return response()->json([
'success' => true,
'message' => 'Data SPBU berhasil dihapus',
]);
}
private function validator(Request $request): \Illuminate\Validation\Validator
{
$validator = Validator::make($request->all(), [
'nama_spbu' => ['required', 'string', 'max:255'],
'nomor_spbu' => ['required', 'string', 'max:50'],
'status' => [
'required',
Rule::in([
Spbu::STATUS_BUKA_24_JAM,
Spbu::STATUS_TIDAK_BUKA_24_JAM,
]),
],
'latitude' => ['required', 'numeric', 'between:-90,90'],
'longitude' => ['required', 'numeric', 'between:-180,180'],
]);
$validator->after(function ($validator) use ($request): void {
if ((float) $request->input('latitude') === 0.0 && (float) $request->input('longitude') === 0.0) {
$validator->errors()->add('latitude', 'Koordinat tidak valid.');
}
});
return $validator;
}
private function validationError(\Illuminate\Validation\Validator $validator): JsonResponse
{
return response()->json([
'success' => false,
'message' => 'Validasi gagal',
'errors' => $validator->errors(),
], 422);
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Spbu extends Model
{
public const STATUS_BUKA_24_JAM = 'Buka 24 Jam';
public const STATUS_TIDAK_BUKA_24_JAM = 'Tidak Buka 24 Jam';
protected $table = 'spbu';
public $timestamps = false;
protected $fillable = [
'nama_spbu',
'nomor_spbu',
'status',
'latitude',
'longitude',
'created_at',
];
protected function casts(): array
{
return [
'latitude' => 'float',
'longitude' => 'float',
'created_at' => 'datetime',
];
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Hidden;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
#[Fillable(['name', 'email', 'password'])]
#[Hidden(['password', 'remember_token'])]
class User extends Authenticatable
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}
+18
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);
+19
View File
@@ -0,0 +1,19 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
//
})
->withExceptions(function (Exceptions $exceptions): void {
//
})->create();
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+7
View File
@@ -0,0 +1,7 @@
<?php
use App\Providers\AppServiceProvider;
return [
AppServiceProvider::class,
];
+83
View File
@@ -0,0 +1,83 @@
{
"$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.3",
"laravel/framework": "^13.0",
"laravel/tinker": "^3.0"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.2.5",
"laravel/pint": "^1.27",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"phpunit/phpunit": "^12.5.12"
},
"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 --seed --force"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"php artisan serve --host=127.0.0.1 --port=8000"
],
"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": "dev",
"prefer-stable": true
}
Generated
+8259
View File
File diff suppressed because it is too large Load Diff
+126
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' => 'UTC',
/*
|--------------------------------------------------------------------------
| 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'),
],
];
+117
View File
@@ -0,0 +1,117 @@
<?php
use App\Models\User;
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', 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' => 60,
'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),
];
+130
View File
@@ -0,0 +1,130 @@
<?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-'),
/*
|--------------------------------------------------------------------------
| Serializable Classes
|--------------------------------------------------------------------------
|
| This value determines the classes that can be unserialized from cache
| storage. By default, no PHP classes will be unserialized from your
| cache to prevent gadget chain attacks if your APP_KEY is leaked.
|
*/
'serializable_classes' => false,
];
+184
View File
@@ -0,0 +1,184 @@
<?php
use Illuminate\Support\Str;
use Pdo\Mysql;
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([
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : 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([
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : 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' => env('DB_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),
],
],
];
+80
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' => rtrim(env('APP_URL', 'http://localhost'), '/').'/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'),
],
];
+132
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', env('APP_NAME', 'Laravel')),
'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
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', env('APP_NAME', 'Laravel')),
],
];
+129
View File
@@ -0,0 +1,129 @@
<?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", "background", "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',
],
'background' => [
'driver' => 'background',
],
'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',
],
];
+38
View File
@@ -0,0 +1,38 @@
<?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' => [
'key' => env('POSTMARK_API_KEY'),
],
'resend' => [
'key' => env('RESEND_API_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'),
],
],
];
+233
View File
@@ -0,0 +1,233 @@
<?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 without 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),
/*
|--------------------------------------------------------------------------
| Session Serialization
|--------------------------------------------------------------------------
|
| This value controls the serialization strategy for session data, which
| is JSON by default. Setting this to "php" allows the storage of PHP
| objects in the session but can make an application vulnerable to
| "gadget chain" serialization attacks if the APP_KEY is leaked.
|
| Supported: "json", "php"
|
*/
'serialization' => 'json',
];
+1
View File
@@ -0,0 +1 @@
*.sqlite*
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends Factory<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,
]);
}
}
@@ -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');
}
};
@@ -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->bigInteger('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->bigInteger('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
@@ -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');
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('spbu', function (Blueprint $table): void {
$table->id();
$table->string('nama_spbu');
$table->string('nomor_spbu', 50);
$table->string('status', 32);
$table->decimal('latitude', 10, 7);
$table->decimal('longitude', 10, 7);
$table->timestamp('created_at')->useCurrent();
$table->index('status', 'idx_status');
$table->index('created_at', 'idx_created');
});
}
public function down(): void
{
Schema::dropIfExists('spbu');
}
};
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace Database\Seeders;
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
{
$this->call(SpbuSeeder::class);
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace Database\Seeders;
use App\Models\Spbu;
use Illuminate\Database\Seeder;
class SpbuSeeder extends Seeder
{
public function run(): void
{
$rows = [
[
'nama_spbu' => 'SPBU Jl. Ahmad Yani',
'nomor_spbu' => '64.751.01',
'status' => Spbu::STATUS_BUKA_24_JAM,
'latitude' => -0.0600366,
'longitude' => 109.3458023,
],
[
'nama_spbu' => 'SPBU Jl. Gajah Mada',
'nomor_spbu' => '64.751.02',
'status' => Spbu::STATUS_TIDAK_BUKA_24_JAM,
'latitude' => -0.0596729,
'longitude' => 109.3469671,
],
];
foreach ($rows as $row) {
Spbu::updateOrCreate(
['nomor_spbu' => $row['nomor_spbu']],
[...$row, 'created_at' => now()]
);
}
}
}
+40
View File
@@ -0,0 +1,40 @@
services:
app:
build: .
ports:
- "8000:8000"
environment:
APP_NAME: "WebGIS SPBU"
APP_ENV: local
APP_DEBUG: "true"
APP_URL: http://localhost:8000
DB_CONNECTION: mysql
DB_HOST: db
DB_PORT: "3306"
DB_DATABASE: spbu_baru
DB_USERNAME: spbu
DB_PASSWORD: secret
SESSION_DRIVER: file
CACHE_STORE: file
QUEUE_CONNECTION: sync
depends_on:
db:
condition: service_healthy
db:
image: mysql:8.0
environment:
MYSQL_DATABASE: spbu_baru
MYSQL_USER: spbu
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: rootsecret
volumes:
- spbu-mysql-data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-prootsecret"]
interval: 5s
timeout: 5s
retries: 20
volumes:
spbu-mysql-data:
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
set -e
if [ ! -f .env ]; then
cp .env.example .env
fi
php docker/sync-env.php
php artisan optimize:clear
if [ -n "${APP_KEY:-}" ]; then
echo "APP_KEY provided by environment, skipping key generation."
elif ! grep -q '^APP_KEY=base64:' .env; then
php artisan key:generate --force
fi
php docker/wait-for-database.php
php artisan migrate --force
php artisan db:seed --force
exec "$@"
+101
View File
@@ -0,0 +1,101 @@
<?php
declare(strict_types=1);
function docker_sync_env_keys(): array
{
return [
'APP_NAME',
'APP_ENV',
'APP_KEY',
'APP_DEBUG',
'APP_URL',
'DB_CONNECTION',
'DB_HOST',
'DB_PORT',
'DB_DATABASE',
'DB_USERNAME',
'DB_PASSWORD',
'SESSION_DRIVER',
'CACHE_STORE',
'QUEUE_CONNECTION',
];
}
function docker_sync_env_format_value(string $value): string
{
if ($value === '') {
return '';
}
if (preg_match('/\A[A-Za-z0-9_\.\/:@+\-]+\z/', $value) === 1) {
return $value;
}
$escaped = str_replace(
["\\", "\"", "\n", "\r"],
["\\\\", "\\\"", "\\n", ''],
$value
);
return "\"{$escaped}\"";
}
function docker_sync_env_file(string $path, array $keys, ?array $values = null): void
{
$lines = file_exists($path) ? file($path, FILE_IGNORE_NEW_LINES) : [];
if ($lines === false) {
throw new RuntimeException("Unable to read {$path}.");
}
$updates = [];
foreach ($keys as $key) {
$value = $values === null ? getenv($key) : ($values[$key] ?? false);
if ($value === false) {
continue;
}
$updates[$key] = docker_sync_env_format_value((string) $value);
}
if ($updates === []) {
return;
}
$seen = [];
foreach ($lines as $index => $line) {
foreach ($updates as $key => $value) {
if (preg_match('/^\s*'.preg_quote($key, '/').'=/i', $line) === 1) {
$lines[$index] = "{$key}={$value}";
$seen[$key] = true;
break;
}
}
}
foreach ($updates as $key => $value) {
if (! isset($seen[$key])) {
$lines[] = "{$key}={$value}";
}
}
$content = implode(PHP_EOL, $lines).PHP_EOL;
if (file_put_contents($path, $content) === false) {
throw new RuntimeException("Unable to write {$path}.");
}
}
$script = isset($_SERVER['SCRIPT_FILENAME']) ? realpath($_SERVER['SCRIPT_FILENAME']) : false;
if ($script !== false && $script === realpath(__FILE__)) {
$path = $argv[1] ?? dirname(__DIR__).'/.env';
docker_sync_env_file($path, docker_sync_env_keys());
fwrite(STDOUT, "Docker environment synchronized into .env.\n");
}
+48
View File
@@ -0,0 +1,48 @@
<?php
function env_value(string $key, string $default = ''): string
{
$value = getenv($key);
if ($value !== false && $value !== '') {
return $value;
}
static $fileVars = null;
if ($fileVars === null) {
$fileVars = is_file(__DIR__.'/../.env')
? parse_ini_file(__DIR__.'/../.env', false, INI_SCANNER_RAW)
: [];
}
return isset($fileVars[$key]) && $fileVars[$key] !== ''
? (string) $fileVars[$key]
: $default;
}
$host = env_value('DB_HOST', '127.0.0.1');
$port = env_value('DB_PORT', '3306');
$database = env_value('DB_DATABASE', 'spbu_baru');
$username = env_value('DB_USERNAME', 'root');
$password = env_value('DB_PASSWORD', '');
$dsn = "mysql:host={$host};port={$port};dbname={$database};charset=utf8mb4";
echo "Waiting for database at {$host}:{$port}...\n";
for ($attempt = 1; $attempt <= 30; $attempt++) {
try {
new PDO($dsn, $username, $password, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_TIMEOUT => 3,
]);
echo "Database connection OK.\n";
exit(0);
} catch (PDOException $exception) {
if ($attempt === 30) {
fwrite(STDERR, "Database unreachable after 30 attempts: {$exception->getMessage()}\n");
exit(1);
}
sleep(2);
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"$schema": "https://www.schemastore.org/package.json",
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"@tailwindcss/vite": "^4.0.0",
"axios": "^1.11.0",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^2.0.0",
"tailwindcss": "^4.0.0",
"vite": "^7.0.7"
}
}
+36
View File
@@ -0,0 +1,36 @@
<?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="DB_URL" value=""/>
<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>
+25
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>
View File
+20
View File
@@ -0,0 +1,20 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';
// Bootstrap Laravel and handle the request...
/** @var Application $app */
$app = require_once __DIR__.'/../bootstrap/app.php';
$app->handleRequest(Request::capture());
+2
View File
@@ -0,0 +1,2 @@
User-agent: *
Disallow:
+11
View File
@@ -0,0 +1,11 @@
@import 'tailwindcss';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';
@theme {
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
}
+1
View File
@@ -0,0 +1 @@
import './bootstrap';
+4
View File
@@ -0,0 +1,4 @@
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
+234
View File
@@ -0,0 +1,234 @@
<!DOCTYPE html>
<html lang="id" data-theme="light">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>WebGIS SPBU</title>
<!-- Leaflet -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css">
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<!-- DaisyUI + Tailwind -->
<link href="https://cdn.jsdelivr.net/npm/daisyui@4/dist/full.min.css" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<!-- Plus Jakarta Sans Font -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap" rel="stylesheet">
<style>
* {
font-family: 'Plus Jakarta Sans', sans-serif;
}
body {
font-weight: 500;
}
h1, h2, h3, h4, h5, h6, .btn, .card-title, .stat-value {
font-weight: 700 !important;
letter-spacing: -0.02em;
}
#bgMap {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
opacity: 0.5;
filter: saturate(1.2) brightness(0.7);
}
.hero {
position: relative;
z-index: 10;
background: transparent !important;
}
/* Glass effect for content */
.hero-content {
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(12px);
padding: 3rem;
border-radius: 2rem;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
border: 1px solid rgba(255, 255, 255, 0.3);
}
[data-theme="dark"] .hero-content {
background: rgba(15, 23, 42, 0.7);
border: 1px solid rgba(255, 255, 255, 0.1);
}
/* Custom Leaflet Control Layers Styling */
.leaflet-control-layers {
border-radius: 12px !important;
border: 1px solid rgba(255, 255, 255, 0.2) !important;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15) !important;
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
background: rgba(255, 255, 255, 0.85) !important;
padding: 8px 12px !important;
font-family: inherit !important;
font-weight: 700 !important;
font-size: 0.85rem !important;
transition: all 0.3s ease !important;
}
.leaflet-control-layers:hover {
background: rgba(255, 255, 255, 0.95) !important;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25) !important;
}
.leaflet-control-layers-list label {
margin-bottom: 4px;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
padding: 4px 6px;
border-radius: 6px;
font-weight: 600 !important;
}
.leaflet-control-layers-list label:hover {
background: rgba(0, 0, 0, 0.05);
}
.leaflet-control-layers-separator {
margin: 8px 0 !important;
border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}
.leaflet-control-layers-selector {
accent-color: var(--lg-primary, #EA580C);
width: 16px;
height: 16px;
margin-top: 0 !important;
}
</style>
@include('partials.localguide-theme')
</head>
<body class="localguide-shell min-h-screen bg-base-200 flex flex-col items-center justify-center overflow-hidden">
<!-- Background Map -->
<div id="bgMap"></div>
<div class="hero min-h-screen">
<div class="hero-content localguide-hero-panel flex-col items-start gap-3">
<div class="localguide-kicker">
<i class="fa-solid fa-location-dot"></i>
Map-forward SPBU guide
</div>
<div class="flex items-center gap-4">
<div class="text-6xl leading-none"></div>
<div>
<h1 class="text-4xl font-bold tracking-tight">WebGIS <span class="localguide-highlight">SPBU</span></h1>
<span class="badge localguide-yellow-badge mt-2">Pontianak fuel station map</span>
</div>
</div>
<p class="max-w-md text-base-content/70 mt-1 mb-2 leading-relaxed">
Sistem Informasi Geografis untuk pemetaan dan pengelolaan
titik-titik Stasiun Pengisian Bahan Bakar Umum.
</p>
<div class="localguide-filter-bar" aria-label="Ringkasan kategori SPBU">
<span class="localguide-filter-chip is-active">
<i class="fa-solid fa-map"></i> Peta utama
</span>
<span class="localguide-filter-chip">
<i class="fa-solid fa-clock"></i> Buka 24 jam
</span>
<span class="localguide-filter-chip">
<i class="fa-solid fa-table-list"></i> Data lokasi
</span>
</div>
<div class="flex flex-col sm:flex-row gap-3">
<a href="{{ route('spbu.input') }}" class="btn btn-primary btn-lg gap-2">
<i class="fa-solid fa-map-location-dot"></i>
Input Data SPBU
</a>
<a href="{{ route('spbu.data') }}" class="btn btn-outline btn-lg gap-2">
<i class="fa-solid fa-table-list"></i>
Lihat Data &amp; Peta
</a>
</div>
<!-- Redirect progress -->
<div class="mt-8 w-72">
<p class="text-xs text-base-content/50 mb-2">Mengarahkan ke halaman Input dalam 5 detik...</p>
<progress class="progress progress-primary w-full" id="redirectProgress" value="0" max="100"></progress>
</div>
</div>
</div>
<script>
// Progress bar logic
let val = 0;
const bar = document.getElementById('redirectProgress');
const tick = setInterval(() => {
val += 100 / 50; // Slower for effect (5s)
bar.value = val;
if (val >= 100) clearInterval(tick);
}, 100);
setTimeout(() => { window.location.href = '{{ route('spbu.input') }}'; }, 5000);
// Background Map logic
const map = L.map('bgMap', {
zoomControl: false,
attributionControl: false,
dragging: false,
scrollWheelZoom: false,
doubleClickZoom: false
}).setView([-0.0606, 109.345], 15);
// Satellite Base
const satellite = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
maxZoom: 19
}).addTo(map);
// Standard Base (Optional)
const osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19
});
// Layer Groups
const layer24h = L.layerGroup().addTo(map);
const layerRegular = L.layerGroup().addTo(map);
// Control (visible but subtle)
L.control.layers({ "Satelit": satellite, "Street": osm },
{ "Buka 24 Jam": layer24h, "Normal": layerRegular },
{ position: 'bottomleft' }).addTo(map);
// Fetch SPBU points to show on background
fetch('/api/spbu')
.then(r => r.json())
.then(data => {
const markers = [];
data.forEach(spbu => {
const is24 = spbu.status === 'Buka 24 Jam';
const group = is24 ? layer24h : layerRegular;
const color = is24 ? "#EA580C" : "#0D9488";
L.circleMarker([+spbu.latitude, +spbu.longitude], {
radius: 6,
fillColor: color,
color: "#fff",
weight: 2,
opacity: 1,
fillOpacity: 0.8
}).addTo(group);
markers.push([+spbu.latitude, +spbu.longitude]);
});
if (markers.length) {
map.fitBounds(markers, { padding: [50, 50] });
}
// Subtle animation: slow pan
let lat = map.getCenter().lat;
setInterval(() => {
lat += 0.00001;
map.panTo([lat, map.getCenter().lng], { animate: true, duration: 1 });
}, 1000);
})
.catch(() => {});
</script>
</body>
</html>
@@ -0,0 +1,243 @@
<style>
:root {
--lg-primary: #EA580C;
--lg-secondary: #0D9488;
--lg-tertiary: #EAB308;
--lg-bg: #FFFFFF;
--lg-surface: #FFFFFF;
--lg-ink: #17201B;
--lg-muted: #66736D;
--lg-border: #E7E2DB;
--lg-success: #16A34A;
--lg-warning: #EAB308;
--lg-error: #DC2626;
--lg-info: #0D9488;
--lg-map-tint: rgba(234, 88, 12, 0.12);
--lg-shadow: 0 18px 45px rgba(23, 32, 27, 0.13);
}
.localguide-shell {
background:
linear-gradient(180deg, rgba(234, 88, 12, 0.07), rgba(255, 255, 255, 0) 260px),
var(--lg-bg) !important;
color: var(--lg-ink);
}
.localguide-shell .btn,
.localguide-shell .input,
.localguide-shell .select,
.localguide-shell .badge,
.localguide-shell .card,
.localguide-shell .modal-box,
.localguide-shell .alert {
border-radius: 8px;
}
.localguide-shell .btn-primary {
background-color: var(--lg-primary) !important;
border-color: var(--lg-primary) !important;
color: #fff !important;
}
.localguide-shell .btn-primary:hover {
background-color: #C2410C !important;
border-color: #C2410C !important;
}
.localguide-shell .btn-outline {
border-color: var(--lg-secondary) !important;
color: var(--lg-secondary) !important;
}
.localguide-shell .btn-outline:hover {
background-color: var(--lg-secondary) !important;
color: #fff !important;
}
.localguide-shell .text-primary,
.localguide-shell .stat-value.text-primary,
.localguide-shell .stat-figure.text-primary {
color: var(--lg-primary) !important;
}
.localguide-shell .progress-primary::-webkit-progress-value {
background-color: var(--lg-primary) !important;
}
.localguide-shell .progress-primary::-moz-progress-bar {
background-color: var(--lg-primary) !important;
}
.localguide-navbar {
background: rgba(255, 255, 255, 0.93) !important;
border-bottom: 1px solid var(--lg-border) !important;
box-shadow: 0 10px 25px rgba(23, 32, 27, 0.08) !important;
backdrop-filter: blur(14px);
}
.localguide-brand {
color: var(--lg-primary) !important;
}
.localguide-active-link {
background: rgba(234, 88, 12, 0.11) !important;
color: var(--lg-primary) !important;
border: 1px solid rgba(234, 88, 12, 0.24);
border-radius: 8px;
}
.localguide-link {
color: var(--lg-secondary) !important;
}
.localguide-hero-panel,
.localguide-panel,
.localguide-shell .card,
.localguide-shell .stats,
.localguide-shell .modal-box {
background: rgba(255, 255, 255, 0.94) !important;
border: 1px solid var(--lg-border) !important;
box-shadow: var(--lg-shadow) !important;
}
.localguide-hero-panel {
max-width: 580px;
text-align: left;
}
.localguide-kicker {
display: inline-flex;
align-items: center;
gap: 0.45rem;
color: var(--lg-secondary);
font-size: 0.78rem;
font-weight: 800;
letter-spacing: 0;
text-transform: uppercase;
}
.localguide-highlight {
color: var(--lg-primary);
}
.localguide-yellow-badge {
background: rgba(234, 179, 8, 0.17) !important;
border: 1px solid rgba(234, 179, 8, 0.28) !important;
color: #854D0E !important;
}
.localguide-filter-panel,
.localguide-filter-bar {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.localguide-filter-panel {
position: absolute;
top: 1rem;
left: 1rem;
z-index: 999;
max-width: min(92vw, 520px);
padding: 0.55rem;
background: rgba(255, 255, 255, 0.92);
border: 1px solid var(--lg-border);
border-radius: 8px;
box-shadow: var(--lg-shadow);
backdrop-filter: blur(14px);
}
.localguide-filter-chip {
display: inline-flex;
align-items: center;
gap: 0.45rem;
min-height: 2.25rem;
padding: 0.45rem 0.7rem;
border: 1px solid var(--lg-border);
border-radius: 999px;
background: var(--lg-surface);
color: var(--lg-muted);
font-size: 0.82rem;
font-weight: 800;
cursor: pointer;
transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}
.localguide-filter-chip:hover {
transform: translateY(-1px);
border-color: rgba(13, 148, 136, 0.42);
color: var(--lg-secondary);
}
.localguide-filter-chip.is-active {
background: var(--lg-primary);
border-color: var(--lg-primary);
color: #fff;
}
.localguide-map-hint {
background: var(--lg-primary) !important;
border: 1px solid rgba(255, 255, 255, 0.35) !important;
color: #fff !important;
border-radius: 999px !important;
}
.localguide-drag-hint {
background: var(--lg-tertiary) !important;
border: 1px solid rgba(255, 255, 255, 0.45) !important;
color: #3F2A05 !important;
border-radius: 999px !important;
}
.localguide-shell .leaflet-control-layers {
border: 1px solid var(--lg-border) !important;
border-radius: 8px !important;
background: rgba(255, 255, 255, 0.93) !important;
box-shadow: var(--lg-shadow) !important;
}
.localguide-shell .leaflet-control-layers-selector {
accent-color: var(--lg-primary) !important;
}
.localguide-shell .leaflet-popup-content-wrapper,
.localguide-shell .leaflet-popup-tip {
border-radius: 8px;
}
.localguide-status-24 {
background: rgba(234, 88, 12, 0.14) !important;
color: var(--lg-primary) !important;
border: 1px solid rgba(234, 88, 12, 0.26) !important;
}
.localguide-status-regular {
background: rgba(13, 148, 136, 0.13) !important;
color: var(--lg-secondary) !important;
border: 1px solid rgba(13, 148, 136, 0.24) !important;
}
.localguide-map-legend-dot-primary {
background: var(--lg-primary);
}
.localguide-map-legend-dot-secondary {
background: var(--lg-secondary);
}
.localguide-shell .table-zebra tbody tr:nth-child(even) {
background: rgba(13, 148, 136, 0.045);
}
@media (max-width: 640px) {
.localguide-hero-panel {
width: calc(100vw - 2rem);
padding: 1.5rem !important;
}
.localguide-filter-panel {
left: 0.75rem;
right: 0.75rem;
}
}
</style>
+633
View File
@@ -0,0 +1,633 @@
<!DOCTYPE html>
<html lang="id" data-theme="light">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Data SPBU - WebGIS</title>
<!-- Leaflet -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="">
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<!-- DaisyUI + Tailwind -->
<link href="https://cdn.jsdelivr.net/npm/daisyui@4/dist/full.min.css" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<!-- Plus Jakarta Sans Font -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap" rel="stylesheet">
<style>
* {
font-family: 'Plus Jakarta Sans', sans-serif;
}
body {
font-weight: 500;
}
h1, h2, h3, h4, h5, h6, .btn, .card-title, .stat-value {
font-weight: 700 !important;
letter-spacing: -0.01em;
}
#previewMap { height: 380px; width: 100%; }
/* Custom Leaflet Control Layers Styling */
.leaflet-control-layers {
border-radius: 12px !important;
border: 1px solid rgba(255, 255, 255, 0.2) !important;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15) !important;
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
background: rgba(255, 255, 255, 0.85) !important;
padding: 8px 12px !important;
font-family: inherit !important;
font-weight: 700 !important;
font-size: 0.85rem !important;
transition: all 0.3s ease !important;
}
.leaflet-control-layers:hover {
background: rgba(255, 255, 255, 0.95) !important;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25) !important;
}
.leaflet-control-layers-list label {
margin-bottom: 4px;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
padding: 4px 6px;
border-radius: 6px;
font-weight: 600 !important;
}
.leaflet-control-layers-list label:hover {
background: rgba(0, 0, 0, 0.05);
}
.leaflet-control-layers-separator {
margin: 8px 0 !important;
border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}
.leaflet-control-layers-selector {
accent-color: var(--lg-primary, #EA580C);
width: 16px;
height: 16px;
margin-top: 0 !important;
}
</style>
@include('partials.localguide-theme')
</head>
<body class="localguide-shell min-h-screen bg-base-200">
<!-- ═══ NAVBAR ═══════════════════════════════════════════════════════════ -->
<div class="navbar localguide-navbar bg-base-100 border-b border-base-200 shadow-sm sticky top-0 z-[1000]">
<div class="flex-1">
<a href="{{ route('home') }}" class="btn btn-ghost text-lg font-bold gap-2 localguide-brand">
<i class="fa-solid fa-gas-pump"></i>
WebGIS SPBU
</a>
</div>
<div class="flex-none">
<ul class="menu menu-horizontal px-1 gap-1">
<li>
<a href="{{ route('spbu.input') }}" class="font-medium localguide-link">
<i class="fa-solid fa-map-location-dot"></i> Input Data
</a>
</li>
<li>
<a href="{{ route('spbu.data') }}"
class="font-semibold localguide-active-link">
<i class="fa-solid fa-table-list"></i> Lihat Data
</a>
</li>
</ul>
</div>
</div>
<!-- ═══ MAIN ══════════════════════════════════════════════════════════════ -->
<main class="max-w-screen-xl mx-auto px-4 py-6">
<!-- Page header -->
<div class="flex flex-wrap items-center justify-between gap-3 mb-6">
<div>
<div class="localguide-kicker mb-1">
<i class="fa-solid fa-compass"></i>
Local discovery dashboard
</div>
<h1 class="text-2xl font-bold">Data <span class="localguide-highlight">SPBU</span></h1>
<p class="text-sm text-base-content/50 mt-1">
Daftar seluruh titik SPBU yang telah terdata dalam sistem
</p>
</div>
<a href="{{ route('spbu.input') }}" class="btn btn-primary gap-2">
<i class="fa-solid fa-plus"></i> Tambah SPBU
</a>
</div>
<!-- Stats -->
<div class="stats stats-horizontal shadow bg-base-100 w-full mb-6 overflow-x-auto">
<div class="stat">
<div class="stat-figure text-primary">
<i class="fa-solid fa-gas-pump text-3xl"></i>
</div>
<div class="stat-title">Total SPBU</div>
<div class="stat-value text-primary" id="statTotal"></div>
</div>
<div class="stat">
<div class="stat-figure text-success">
<i class="fa-solid fa-clock-rotate-left text-3xl"></i>
</div>
<div class="stat-title">Buka 24 Jam</div>
<div class="stat-value text-success" id="stat24j"></div>
</div>
<div class="stat">
<div class="stat-figure text-error">
<i class="fa-solid fa-circle-xmark text-3xl"></i>
</div>
<div class="stat-title">Tidak 24 Jam</div>
<div class="stat-value text-error" id="statNon24"></div>
</div>
</div>
<div class="localguide-filter-bar mb-5" aria-label="Filter kategori SPBU">
<button type="button" class="localguide-filter-chip is-active" data-filter="all">
<i class="fa-solid fa-layer-group"></i>
Semua
</button>
<button type="button" class="localguide-filter-chip" data-filter="24h">
<i class="fa-solid fa-clock"></i>
Buka 24 Jam
</button>
<button type="button" class="localguide-filter-chip" data-filter="regular">
<i class="fa-solid fa-compass"></i>
Tidak 24 Jam
</button>
</div>
<!-- Content grid -->
<div class="grid grid-cols-1 lg:grid-cols-[1fr_380px] gap-5 items-start">
<!-- ── TABEL ─────────────────────────────────────────────────── -->
<div class="card bg-base-100 shadow">
<div class="card-body p-0">
<!-- Card header -->
<div class="flex items-center justify-between px-5 pt-5 pb-3 border-b border-base-200">
<h2 class="card-title text-base">
<i class="fa-solid fa-list text-primary"></i>
Daftar SPBU
</h2>
<span class="text-xs text-base-content/50" id="totalBadge">Memuat...</span>
</div>
<!-- Search -->
<div class="px-5 py-3 border-b border-base-200">
<label class="input input-bordered input-sm flex items-center gap-2 w-full">
<i class="fa-solid fa-magnifying-glass text-base-content/40"></i>
<input type="text" id="searchInput" class="grow"
placeholder="Cari nama atau nomor SPBU...">
</label>
</div>
<!-- Table -->
<div id="loadingTable" class="flex items-center justify-center gap-3 py-16
text-sm text-base-content/50">
<span class="loading loading-spinner loading-md"></span>
Memuat data...
</div>
<div class="overflow-x-auto">
<table class="table table-zebra table-sm" id="dataTable" style="display:none">
<thead>
<tr class="text-xs text-base-content/60">
<th>#</th>
<th>Nama SPBU</th>
<th>Nomor</th>
<th>Status</th>
<th>Koordinat</th>
<th class="text-center">Aksi</th>
</tr>
</thead>
<tbody id="tableBody"></tbody>
</table>
</div>
<!-- Empty state -->
<div id="emptyState" class="text-center py-16 hidden">
<div class="text-4xl mb-3">📭</div>
<p class="font-semibold text-base-content/60">Belum ada data SPBU</p>
<p class="text-sm text-base-content/40 mt-1">
Tambahkan SPBU melalui halaman Input Data
</p>
</div>
</div>
</div>
<!-- ── SIDEBAR ───────────────────────────────────────────────── -->
<div class="flex flex-col gap-5">
<!-- Mini Map -->
<div class="card bg-base-100 shadow overflow-hidden">
<div class="card-body p-0">
<div class="flex items-center gap-2 px-4 py-3 border-b border-base-200">
<i class="fa-solid fa-map text-primary"></i>
<span class="font-semibold text-sm">Peta Sebaran</span>
</div>
<div id="previewMap"></div>
<div class="flex gap-4 px-4 py-2 border-t border-base-200 text-xs text-base-content/60">
<span class="flex items-center gap-1">
<span class="inline-block w-2.5 h-2.5 rounded-full localguide-map-legend-dot-primary"></span>
Buka 24 Jam
</span>
<span class="flex items-center gap-1">
<span class="inline-block w-2.5 h-2.5 rounded-full localguide-map-legend-dot-secondary"></span>
Tidak 24 Jam
</span>
</div>
</div>
</div>
<!-- Quick List -->
<div class="card bg-base-100 shadow">
<div class="card-body p-0">
<div class="flex items-center gap-2 px-4 py-3 border-b border-base-200">
<i class="fa-solid fa-list-ul text-primary"></i>
<span class="font-semibold text-sm">Daftar Cepat</span>
</div>
<div class="max-h-80 overflow-y-auto" id="quickList">
<div class="flex items-center justify-center gap-2 py-10
text-sm text-base-content/40">
<span class="loading loading-spinner loading-sm"></span>
Memuat...
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- ═══ MODAL: KONFIRMASI HAPUS ══════════════════════════════════════════ -->
<dialog id="confirmModal" class="modal">
<div class="modal-box max-w-sm">
<!-- Header merah -->
<div class="flex items-center gap-3 mb-5">
<div class="bg-error/10 text-error rounded-full w-11 h-11 flex items-center justify-center flex-shrink-0">
<i class="fa-solid fa-triangle-exclamation text-lg"></i>
</div>
<div>
<h3 class="font-bold">Hapus Data SPBU</h3>
<p class="text-xs text-base-content/50">Tindakan ini tidak dapat dibatalkan</p>
</div>
<button class="btn btn-sm btn-circle btn-ghost ml-auto" id="btnTutupKonfirmasi"></button>
</div>
<p class="text-sm text-base-content/70 mb-2">
Apakah kamu yakin ingin menghapus data SPBU berikut?
</p>
<div class="bg-base-200 border-l-4 border-error rounded px-3 py-2 font-semibold mb-4"
id="confirmName"></div>
<div class="alert alert-error alert-sm py-2 text-xs mb-4">
<i class="fa-solid fa-circle-info"></i>
Data yang dihapus tidak bisa dikembalikan.
</div>
<div class="modal-action mt-0">
<button class="btn btn-sm" id="btnBatal">
<i class="fa-solid fa-xmark"></i> Batal
</button>
<button class="btn btn-sm btn-error" id="btnYaHapus">
<i class="fa-solid fa-trash"></i> Ya, Hapus
</button>
</div>
</div>
<form method="dialog" class="modal-backdrop">
<button>close</button>
</form>
</dialog>
<!-- ═══ TOAST ══════════════════════════════════════════════════════════════ -->
<div class="toast toast-end toast-bottom z-[99999]" id="toastContainer"></div>
<!-- ═══ JAVASCRIPT ════════════════════════════════════════════════════════ -->
<script>
const API = '/api/spbu';
const LG_PRIMARY = '#EA580C';
const LG_SECONDARY = '#0D9488';
// ── MAP ─────────────────────────────────────────────────────────────────
const previewMap = L.map('previewMap', {
center: [-0.0606, 109.345],
zoom: 14
});
// 1. Base Maps
const osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
const esriSatellite = L.layerGroup([
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
maxZoom: 19,
attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
}),
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}', {
maxZoom: 19
}),
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}', {
maxZoom: 19
})
]).addTo(previewMap);
// 2. Layer Groups (Overlays)
const layer24h = L.layerGroup().addTo(previewMap);
const layerRegular = L.layerGroup().addTo(previewMap);
const baseMaps = {
"Satelit (Hybrid)": esriSatellite,
"Standard Map": osm
};
const overlays = {
"SPBU Buka 24 Jam": layer24h,
"SPBU Tidak Buka 24 Jam": layerRegular
};
L.control.layers(baseMaps, overlays, { collapsed: true }).addTo(previewMap);
function makeIcon(color) {
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 42" width="32" height="42">
<path d="M16 0C7.163 0 0 7.163 0 16c0 12 16 26 16 26S32 28 32 16C32 7.163 24.837 0 16 0z"
fill="${color}" stroke="white" stroke-width="2"/>
<text x="16" y="21" text-anchor="middle" fill="white"
font-size="13" font-family="Arial" font-weight="bold"></text>
</svg>`;
return L.divIcon({ html: svg, className: '', iconSize:[32,42], iconAnchor:[16,42], popupAnchor:[0,-44] });
}
// ── STATE ────────────────────────────────────────────────────────────────
let allData = [];
let mapMarkers = {};
let activeFilter = 'all';
// ── MODAL ────────────────────────────────────────────────────────────────
const confirmModal = document.getElementById('confirmModal');
// ── HELPERS ──────────────────────────────────────────────────────────────
function esc(str) {
const d = document.createElement('div');
d.appendChild(document.createTextNode(str));
return d.innerHTML;
}
function showToast(msg, type = 'info') {
const t = document.createElement('div');
const cls = type === 'success' ? 'alert-success' : type === 'error' ? 'alert-error' : 'alert-info';
t.className = `alert ${cls} shadow-md`;
t.innerHTML = `<span>${msg}</span>`;
document.getElementById('toastContainer').appendChild(t);
setTimeout(() => t.remove(), 3500);
}
// ── LOAD ─────────────────────────────────────────────────────────────────
function loadData() {
document.getElementById('loadingTable').style.display = 'flex';
document.getElementById('dataTable').style.display = 'none';
document.getElementById('emptyState').classList.add('hidden');
// Clear previous layer groups
layer24h.clearLayers();
layerRegular.clearLayers();
mapMarkers = {};
fetch(API)
.then(r => r.json())
.then(data => {
allData = data;
renderStats(data);
renderMarkers(data);
applyFilters();
})
.catch(() => {
document.getElementById('loadingTable').style.display = 'none';
document.getElementById('emptyState').classList.remove('hidden');
document.getElementById('totalBadge').textContent = 'Gagal memuat data';
renderStats([]);
});
}
// ── STATS ────────────────────────────────────────────────────────────────
function renderStats(data) {
const total = data.length;
const buka = data.filter(d => d.status === 'Buka 24 Jam').length;
document.getElementById('statTotal').textContent = total;
document.getElementById('stat24j').textContent = buka;
document.getElementById('statNon24').textContent = total - buka;
document.getElementById('totalBadge').textContent = total + ' data';
}
function matchesActiveFilter(spbu) {
if (activeFilter === '24h') {
return spbu.status === 'Buka 24 Jam';
}
if (activeFilter === 'regular') {
return spbu.status !== 'Buka 24 Jam';
}
return true;
}
function getFilteredData() {
const q = document.getElementById('searchInput').value.toLowerCase();
return allData.filter(spbu => matchesActiveFilter(spbu))
.filter(spbu =>
spbu.nama_spbu.toLowerCase().includes(q) ||
spbu.nomor_spbu.toLowerCase().includes(q)
);
}
function applyFilters() {
const filtered = getFilteredData();
renderTable(filtered);
renderQuickList(filtered);
document.getElementById('totalBadge').textContent = filtered.length + ' data';
}
// ── TABLE ────────────────────────────────────────────────────────────────
function renderTable(data) {
document.getElementById('loadingTable').style.display = 'none';
if (!data.length) {
document.getElementById('emptyState').classList.remove('hidden');
document.getElementById('dataTable').style.display = 'none';
return;
}
document.getElementById('emptyState').classList.add('hidden');
document.getElementById('dataTable').style.display = 'table';
document.getElementById('tableBody').innerHTML = data.map((spbu, i) => {
const is24 = spbu.status === 'Buka 24 Jam';
const badgeCls = is24 ? 'localguide-status-24' : 'localguide-status-regular';
const badgeIco = is24 ? '●' : '◆';
const lat = parseFloat(spbu.latitude).toFixed(5);
const lng = parseFloat(spbu.longitude).toFixed(5);
const namaJS = spbu.nama_spbu.replace(/'/g, "\\'");
return `
<tr class="hover cursor-pointer">
<td class="text-base-content/50 text-xs font-semibold"
onclick="focusMap(${spbu.latitude},${spbu.longitude},${spbu.id})">${i+1}</td>
<td onclick="focusMap(${spbu.latitude},${spbu.longitude},${spbu.id})">
<span class="font-semibold">${esc(spbu.nama_spbu)}</span>
</td>
<td class="text-xs text-base-content/60"
onclick="focusMap(${spbu.latitude},${spbu.longitude},${spbu.id})">
${esc(spbu.nomor_spbu)}
</td>
<td onclick="focusMap(${spbu.latitude},${spbu.longitude},${spbu.id})">
<span class="badge ${badgeCls} badge-sm gap-1">${badgeIco} ${esc(spbu.status)}</span>
</td>
<td class="font-mono text-xs text-base-content/50"
onclick="focusMap(${spbu.latitude},${spbu.longitude},${spbu.id})">
${lat}<br>${lng}
</td>
<td class="text-center">
<button class="btn btn-xs btn-outline btn-error gap-1"
onclick="bukaKonfirmasi(${spbu.id}, '${namaJS}')">
<i class="fa-solid fa-trash"></i> Hapus
</button>
</td>
</tr>`;
}).join('');
}
// ── MARKERS ───────────────────────────────────────────────────────────────
function renderMarkers(data) {
const bounds = [];
data.forEach(spbu => {
const is24 = spbu.status === 'Buka 24 Jam';
const color = is24 ? LG_PRIMARY : LG_SECONDARY;
const group = is24 ? layer24h : layerRegular;
const m = L.marker([+spbu.latitude, +spbu.longitude], { icon: makeIcon(color) })
.addTo(group)
.bindPopup(`
<div style="font-family:ui-sans-serif,system-ui,sans-serif;min-width:150px">
<b> ${esc(spbu.nama_spbu)}</b><br>
<span style="font-size:0.78rem;color:#6b7280">No: ${esc(spbu.nomor_spbu)}</span><br>
<span class="badge ${spbu.status === 'Buka 24 Jam' ? 'localguide-status-24' : 'localguide-status-regular'}"
style="font-size:0.7rem;margin-top:5px">${esc(spbu.status)}</span>
</div>`);
mapMarkers[spbu.id] = m;
bounds.push([+spbu.latitude, +spbu.longitude]);
});
if (bounds.length) previewMap.fitBounds(bounds, { padding: [28, 28] });
}
function focusMap(lat, lng, id) {
previewMap.flyTo([lat, lng], 17, { animate: true, duration: 1 });
if (mapMarkers[id]) mapMarkers[id].openPopup();
window.scrollTo({ top: 0, behavior: 'smooth' });
}
// ── QUICK LIST ─────────────────────────────────────────────────────────
function renderQuickList(data) {
const el = document.getElementById('quickList');
if (!data.length) {
el.innerHTML = `<div class="text-center py-10 text-sm text-base-content/40">
📭 Belum ada data</div>`;
return;
}
el.innerHTML = data.map(spbu => {
const is24 = spbu.status === 'Buka 24 Jam';
return `
<div class="flex gap-3 items-start px-4 py-3 border-b border-base-200
hover:bg-base-200 cursor-pointer transition-colors"
onclick="focusMap(${spbu.latitude},${spbu.longitude},${spbu.id})">
<span class="text-xl mt-0.5"></span>
<div>
<div class="font-semibold text-sm">${esc(spbu.nama_spbu)}</div>
<div class="text-xs text-base-content/50">${esc(spbu.nomor_spbu)}</div>
<span class="badge ${is24 ? 'localguide-status-24' : 'localguide-status-regular'} badge-sm mt-1">
${is24 ? '●' : '◆'} ${esc(spbu.status)}
</span>
</div>
</div>`;
}).join('');
}
// ── SEARCH ────────────────────────────────────────────────────────────
document.getElementById('searchInput').addEventListener('input', function () {
applyFilters();
});
document.querySelectorAll('[data-filter]').forEach(button => {
button.addEventListener('click', function () {
activeFilter = this.dataset.filter;
document.querySelectorAll('[data-filter]').forEach(item => {
item.classList.toggle('is-active', item === this);
});
applyFilters();
});
});
// ── HAPUS ─────────────────────────────────────────────────────────────
let pendingId = null;
function bukaKonfirmasi(id, nama) {
pendingId = id;
document.getElementById('confirmName').textContent = '⛽ ' + nama;
confirmModal.showModal();
}
function tutupKonfirmasi() { confirmModal.close(); pendingId = null; }
document.getElementById('btnBatal').addEventListener('click', tutupKonfirmasi);
document.getElementById('btnTutupKonfirmasi').addEventListener('click', tutupKonfirmasi);
confirmModal.addEventListener('close', () => { pendingId = null; });
document.getElementById('btnYaHapus').addEventListener('click', function () {
if (!pendingId) return;
const btn = this;
btn.disabled = true;
btn.innerHTML = '<span class="loading loading-spinner loading-xs"></span> Menghapus...';
fetch(`${API}/${pendingId}`, {
method: 'DELETE',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: pendingId })
})
.then(r => r.json())
.then(res => {
btn.disabled = false;
btn.innerHTML = '<i class="fa-solid fa-trash"></i> Ya, Hapus';
if (res.success) {
tutupKonfirmasi();
showToast('Data SPBU berhasil dihapus! 🗑️', 'success');
loadData();
} else {
showToast('Gagal: ' + (res.message || 'Error server'), 'error');
}
})
.catch(() => {
btn.disabled = false;
btn.innerHTML = '<i class="fa-solid fa-trash"></i> Ya, Hapus';
showToast('Tidak dapat terhubung ke server!', 'error');
});
});
// ── INIT ─────────────────────────────────────────────────────────────
loadData();
</script>
</body>
</html>
+726
View File
@@ -0,0 +1,726 @@
<!DOCTYPE html>
<html lang="id" data-theme="light">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Input Data SPBU - WebGIS</title>
<!-- Leaflet -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="">
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<!-- DaisyUI + Tailwind -->
<link href="https://cdn.jsdelivr.net/npm/daisyui@4/dist/full.min.css" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<!-- Plus Jakarta Sans Font -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap" rel="stylesheet">
<style>
* {
font-family: 'Plus Jakarta Sans', sans-serif;
}
body {
font-weight: 500;
}
h1, h2, h3, h4, h5, h6, .btn, .card-title, .stat-value {
font-weight: 700 !important;
letter-spacing: -0.01em;
}
html, body { height: 100%; }
body { display: flex; flex-direction: column; overflow: hidden; }
.map-wrapper { flex: 1; position: relative; min-height: 0; }
#map { width: 100%; height: 100%; }
/* Drag cursor for Leaflet marker */
.leaflet-marker-draggable { cursor: grab !important; }
.leaflet-dragging .leaflet-marker-draggable { cursor: grabbing !important; }
/* Spinner inside leaflet popup */
@keyframes _spin { to { transform: rotate(360deg); } }
._spin { animation: _spin .7s linear infinite; }
/* Custom Leaflet Control Layers Styling */
.leaflet-control-layers {
border-radius: 12px !important;
border: 1px solid rgba(255, 255, 255, 0.2) !important;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15) !important;
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
background: rgba(255, 255, 255, 0.85) !important;
padding: 8px 12px !important;
font-family: inherit !important;
font-weight: 700 !important;
font-size: 0.85rem !important;
transition: all 0.3s ease !important;
}
.leaflet-control-layers:hover {
background: rgba(255, 255, 255, 0.95) !important;
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25) !important;
}
.leaflet-control-layers-list label {
margin-bottom: 4px;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
padding: 4px 6px;
border-radius: 6px;
font-weight: 600 !important;
}
.leaflet-control-layers-list label:hover {
background: rgba(0, 0, 0, 0.05);
}
.leaflet-control-layers-separator {
margin: 8px 0 !important;
border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}
.leaflet-control-layers-selector {
accent-color: var(--lg-primary, #EA580C);
width: 16px;
height: 16px;
margin-top: 0 !important;
}
</style>
@include('partials.localguide-theme')
</head>
<body class="localguide-shell">
<!-- ═══ NAVBAR ═══════════════════════════════════════════════════════════ -->
<div class="navbar localguide-navbar bg-base-100 border-b border-base-200 shadow-sm flex-shrink-0 z-[1000]">
<div class="flex-1">
<a href="{{ route('home') }}" class="btn btn-ghost text-lg font-bold gap-2 localguide-brand">
<i class="fa-solid fa-gas-pump"></i>
WebGIS SPBU
</a>
</div>
<div class="flex-none">
<ul class="menu menu-horizontal px-1 gap-1">
<li>
<a href="{{ route('spbu.input') }}"
class="font-semibold localguide-active-link">
<i class="fa-solid fa-map-location-dot"></i> Input Data
</a>
</li>
<li>
<a href="{{ route('spbu.data') }}" class="font-medium localguide-link">
<i class="fa-solid fa-table-list"></i> Lihat Data
</a>
</li>
</ul>
</div>
</div>
<!-- ═══ MAP ══════════════════════════════════════════════════════════════ -->
<div class="map-wrapper">
<div id="map"></div>
<div class="localguide-filter-panel" aria-label="Filter layer SPBU">
<button type="button" class="localguide-filter-chip is-active" data-layer-filter="all">
<i class="fa-solid fa-layer-group"></i>
Semua
</button>
<button type="button" class="localguide-filter-chip" data-layer-filter="24h">
<i class="fa-solid fa-clock"></i>
Buka 24 Jam
</button>
<button type="button" class="localguide-filter-chip" data-layer-filter="regular">
<i class="fa-solid fa-compass"></i>
Tidak 24 Jam
</button>
</div>
<!-- Normal hint -->
<div id="mapHint"
class="absolute bottom-8 left-1/2 -translate-x-1/2 z-[999] pointer-events-none
badge localguide-map-hint badge-lg py-3 px-4 gap-2 shadow-md">
<i class="fa-solid fa-hand-pointer"></i>
Klik peta untuk tambah SPBU &bull; Drag marker untuk pindah lokasi
</div>
<!-- Drag hint -->
<div id="dragHint"
class="absolute bottom-8 left-1/2 -translate-x-1/2 z-[999] pointer-events-none hidden
badge localguide-drag-hint badge-lg py-3 px-4 gap-2 shadow-md">
<i class="fa-solid fa-arrows-up-down-left-right"></i>
Lepaskan untuk menyimpan lokasi baru
</div>
</div>
<!-- ═══ MODAL: INPUT (dialog DaisyUI) ════════════════════════════════════ -->
<dialog id="inputModal" class="modal">
<div class="modal-box">
<!-- Header -->
<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
id="btnCloseModal"></button>
<h3 class="font-bold text-lg flex items-center gap-2 mb-1">
<i class="fa-solid fa-gas-pump text-primary"></i>
Tambah Data SPBU
</h3>
<p class="text-sm text-base-content/50 mb-4">Isi atribut titik lokasi baru</p>
<!-- Koordinat -->
<div class="alert alert-info py-2 mb-4 text-sm">
<i class="fa-solid fa-location-crosshairs"></i>
<span id="coordText">Memuat koordinat...</span>
</div>
<!-- Form -->
<label class="form-control mb-3">
<div class="label"><span class="label-text font-semibold">Nama SPBU</span></div>
<input type="text" id="namaSPBU" class="input input-bordered w-full"
placeholder="Contoh: SPBU Jl. Ahmad Yani" autocomplete="off">
</label>
<label class="form-control mb-3">
<div class="label"><span class="label-text font-semibold">Nomor SPBU</span></div>
<input type="text" id="nomorSPBU" class="input input-bordered w-full"
placeholder="Contoh: 64.751.01" autocomplete="off">
</label>
<label class="form-control mb-4">
<div class="label"><span class="label-text font-semibold">Status Operasional</span></div>
<select id="statusSPBU" class="select select-bordered w-full">
<option value="">-- Pilih Status --</option>
<option value="Buka 24 Jam">☀️🌙 Buka 24 Jam</option>
<option value="Tidak Buka 24 Jam"> Tidak Buka 24 Jam</option>
</select>
</label>
<div class="modal-action">
<button class="btn" id="btnCancel">
<i class="fa-solid fa-xmark"></i> Batal
</button>
<button class="btn btn-primary" id="btnSimpan">
<i class="fa-solid fa-floppy-disk"></i> Simpan
</button>
</div>
</div>
<!-- Backdrop click = close -->
<form method="dialog" class="modal-backdrop">
<button id="btnBackdropInput">close</button>
</form>
</dialog>
<!-- ═══ MODAL: EDIT ═══════════════════════════════════════════════════════ -->
<dialog id="editModal" class="modal">
<div class="modal-box">
<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
id="btnCloseEditModal"></button>
<h3 class="font-bold text-lg flex items-center gap-2 mb-1 text-warning">
<i class="fa-solid fa-pen-to-square"></i>
Edit Data SPBU
</h3>
<p class="text-sm text-base-content/50 mb-4">Perbarui atribut titik lokasi</p>
<div class="alert alert-info py-2 mb-4 text-sm">
<i class="fa-solid fa-location-crosshairs"></i>
<span id="editCoordText">Memuat koordinat...</span>
</div>
<label class="form-control mb-3">
<div class="label"><span class="label-text font-semibold">Nama SPBU</span></div>
<input type="text" id="editNamaSPBU" class="input input-bordered w-full"
placeholder="Contoh: SPBU Jl. Ahmad Yani" autocomplete="off">
</label>
<label class="form-control mb-3">
<div class="label"><span class="label-text font-semibold">Nomor SPBU</span></div>
<input type="text" id="editNomorSPBU" class="input input-bordered w-full"
placeholder="Contoh: 64.751.01" autocomplete="off">
</label>
<label class="form-control mb-4">
<div class="label"><span class="label-text font-semibold">Status Operasional</span></div>
<select id="editStatusSPBU" class="select select-bordered w-full">
<option value="">-- Pilih Status --</option>
<option value="Buka 24 Jam">☀️🌙 Buka 24 Jam</option>
<option value="Tidak Buka 24 Jam"> Tidak Buka 24 Jam</option>
</select>
</label>
<div class="modal-action">
<button class="btn" id="btnCancelEdit">
<i class="fa-solid fa-xmark"></i> Batal
</button>
<button class="btn btn-warning text-white" id="btnUpdate">
<i class="fa-solid fa-floppy-disk"></i> Perbarui
</button>
</div>
</div>
<form method="dialog" class="modal-backdrop">
<button id="btnBackdropEdit">close</button>
</form>
</dialog>
<!-- ═══ MODAL: KONFIRMASI HAPUS ══════════════════════════════════════════ -->
<dialog id="deleteModal" class="modal">
<div class="modal-box text-center max-w-sm">
<div class="text-5xl mb-3">🗑️</div>
<h3 class="font-bold text-lg mb-1">Hapus Data SPBU?</h3>
<p class="text-sm text-base-content/60 mb-1">
Data <strong id="deleteSpbuName"></strong> akan dihapus secara permanen.
</p>
<p class="text-sm text-error mb-5">⚠️ Tindakan ini tidak dapat dibatalkan.</p>
<div class="modal-action justify-center">
<button class="btn" id="btnCancelDelete">
<i class="fa-solid fa-xmark"></i> Batal
</button>
<button class="btn btn-error" id="btnConfirmDelete">
<i class="fa-solid fa-trash"></i> Ya, Hapus
</button>
</div>
</div>
<form method="dialog" class="modal-backdrop">
<button id="btnBackdropDelete">close</button>
</form>
</dialog>
<!-- ═══ TOAST CONTAINER ════════════════════════════════════════════════════ -->
<div class="toast toast-end toast-bottom z-[99999]" id="toastContainer"></div>
<!-- ═══ JAVASCRIPT ════════════════════════════════════════════════════════ -->
<script>
// ── CONFIG ──────────────────────────────────────────────────────────────
const API = '/api/spbu';
const LG_PRIMARY = '#EA580C';
const LG_SECONDARY = '#0D9488';
const LG_TERTIARY = '#EAB308';
// ── MODAL REFS ─────────────────────────────────────────────────────────
const inputModal = document.getElementById('inputModal');
const editModal = document.getElementById('editModal');
const deleteModal = document.getElementById('deleteModal');
// ── MAP INIT ────────────────────────────────────────────────────────────
const map = L.map('map', {
center: [-0.06058602521208944, 109.34498961534207],
zoom: 16,
zoomControl: false
});
L.control.zoom({ position: 'bottomleft' }).addTo(map);
// 1. Base Maps
const osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
const esriSatellite = L.layerGroup([
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
maxZoom: 19,
attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
}),
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}', {
maxZoom: 19
}),
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/{z}/{y}/{x}', {
maxZoom: 19
})
]).addTo(map);
// 2. Layer Groups (Overlays)
const layer24h = L.layerGroup().addTo(map);
const layerRegular = L.layerGroup().addTo(map);
const baseMaps = {
"Satelit (Hybrid)": esriSatellite,
"Standard Map": osm
};
const overlays = {
"SPBU Buka 24 Jam": layer24h,
"SPBU Tidak Buka 24 Jam": layerRegular
};
L.control.layers(baseMaps, overlays, { collapsed: false }).addTo(map);
function setLayerFilter(filter) {
if (filter === 'all' || filter === '24h') {
if (!map.hasLayer(layer24h)) map.addLayer(layer24h);
} else if (map.hasLayer(layer24h)) {
map.removeLayer(layer24h);
}
if (filter === 'all' || filter === 'regular') {
if (!map.hasLayer(layerRegular)) map.addLayer(layerRegular);
} else if (map.hasLayer(layerRegular)) {
map.removeLayer(layerRegular);
}
document.querySelectorAll('[data-layer-filter]').forEach(button => {
button.classList.toggle('is-active', button.dataset.layerFilter === filter);
});
}
document.querySelectorAll('[data-layer-filter]').forEach(button => {
button.addEventListener('click', () => setLayerFilter(button.dataset.layerFilter));
});
function createSpbuIcon(color = LG_PRIMARY) {
const svg = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 42" width="32" height="42">
<path d="M16 0C7.163 0 0 7.163 0 16c0 12 16 26 16 26S32 28 32 16C32 7.163 24.837 0 16 0z"
fill="${color}" stroke="white" stroke-width="2"/>
<text x="16" y="21" text-anchor="middle" fill="white"
font-size="13" font-family="Arial" font-weight="bold"></text>
</svg>`;
return L.divIcon({ html: svg, className: '', iconSize:[32,42], iconAnchor:[16,42], popupAnchor:[0,-44] });
}
// ── STATE ───────────────────────────────────────────────────────────────
let pendingLatLng = null;
let tempMarker = null;
const spbuMap = new Map(); // id => { marker, data }
// ── POPUP CONTENT ───────────────────────────────────────────────────────
function buildPopupContent(spbu) {
const isOpen = spbu.status === 'Buka 24 Jam';
const badgeCls = isOpen ? 'localguide-status-24' : 'localguide-status-regular';
const lat = parseFloat(spbu.latitude).toFixed(6);
const lng = parseFloat(spbu.longitude).toFixed(6);
return `
<div style="font-family:ui-sans-serif,system-ui,sans-serif;min-width:210px">
<div style="font-weight:700;font-size:0.95rem;margin-bottom:5px"> ${spbu.nama_spbu}</div>
<div style="font-size:0.8rem;color:#6b7280;margin-bottom:6px">
<b>No:</b> ${spbu.nomor_spbu}
</div>
<span class="badge ${badgeCls}" style="font-size:0.72rem">
${isOpen ? '●' : '◆'} ${spbu.status}
</span>
<div style="font-size:0.7rem;color:#9ca3af;margin-top:5px">${lat}, ${lng}</div>
<div style="display:flex;gap:6px;margin-top:10px;padding-top:8px;border-top:1px solid #f3f4f6">
<button class="btn btn-xs btn-outline btn-primary"
onclick="openEditModal(${spbu.id})">
<i class="fa-solid fa-pen-to-square"></i> Edit
</button>
<button class="btn btn-xs btn-outline btn-error"
onclick="openDeleteConfirm(${spbu.id})">
<i class="fa-solid fa-trash"></i> Hapus
</button>
</div>
</div>`;
}
// ── LOAD DATA ───────────────────────────────────────────────────────────
function loadExistingData() {
fetch(API)
.then(r => r.json())
.then(data => data.forEach(addSpbuMarker))
.catch(() => console.log('Tidak dapat memuat data dari server.'));
}
function addSpbuMarker(spbu) {
const isOpen = spbu.status === 'Buka 24 Jam';
const color = isOpen ? LG_PRIMARY : LG_SECONDARY;
const group = isOpen ? layer24h : layerRegular;
const m = L.marker([parseFloat(spbu.latitude), parseFloat(spbu.longitude)], {
icon: createSpbuIcon(color),
draggable: true
})
.addTo(group)
.bindPopup(buildPopupContent(spbu), { maxWidth: 270 });
const id = parseInt(spbu.id);
spbuMap.set(id, { marker: m, data: { ...spbu } });
// ── DRAG START
m.on('dragstart', function () {
this.setOpacity(0.55);
map.closePopup();
document.getElementById('dragHint').classList.remove('hidden');
document.getElementById('mapHint').classList.add('hidden');
});
// ── DRAG END → update DB
m.on('dragend', function (e) {
this.setOpacity(1);
document.getElementById('dragHint').classList.add('hidden');
document.getElementById('mapHint').classList.remove('hidden');
const newLatLng = e.target.getLatLng();
const entry = spbuMap.get(id);
if (!entry) return;
// Loading popup
this.bindPopup(`
<div style="font-family:ui-sans-serif,system-ui,sans-serif;
padding:12px;text-align:center;min-width:160px">
<span class="loading loading-spinner loading-sm text-warning"></span>
<span style="font-size:0.84rem;margin-left:6px;vertical-align:middle">
Menyimpan lokasi baru...
</span>
</div>`, { maxWidth: 270 }).openPopup();
fetch(`${API}/${id}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id,
nama_spbu : entry.data.nama_spbu,
nomor_spbu : entry.data.nomor_spbu,
status : entry.data.status,
latitude : newLatLng.lat,
longitude : newLatLng.lng
})
})
.then(r => r.json())
.then(res => {
if (res.success) {
entry.data.latitude = newLatLng.lat;
entry.data.longitude = newLatLng.lng;
this.setPopupContent(buildPopupContent(entry.data)).openPopup();
showToast(`📍 Lokasi ${entry.data.nama_spbu} berhasil dipindahkan!`, 'success');
} else {
this.setLatLng([parseFloat(entry.data.latitude), parseFloat(entry.data.longitude)]);
this.setPopupContent(buildPopupContent(entry.data)).openPopup();
showToast('Gagal memperbarui lokasi: ' + (res.message || 'Error'), 'error');
}
})
.catch(() => {
this.setLatLng([parseFloat(entry.data.latitude), parseFloat(entry.data.longitude)]);
this.setPopupContent(buildPopupContent(entry.data)).openPopup();
showToast('Tidak dapat terhubung ke server!', 'error');
});
});
}
loadExistingData();
// ── MAP CLICK → buka modal tambah ──────────────────────────────────────
map.on('click', function (e) {
pendingLatLng = e.latlng;
if (tempMarker) map.removeLayer(tempMarker);
tempMarker = L.marker(e.latlng, {
icon: createSpbuIcon(LG_TERTIARY), opacity: 0.85
}).addTo(map);
document.getElementById('coordText').textContent =
`Lat: ${e.latlng.lat.toFixed(6)}, Lng: ${e.latlng.lng.toFixed(6)}`;
document.getElementById('namaSPBU').value = '';
document.getElementById('nomorSPBU').value = '';
document.getElementById('statusSPBU').value = '';
inputModal.showModal();
setTimeout(() => document.getElementById('namaSPBU').focus(), 300);
});
// ── CLOSE INPUT MODAL ──────────────────────────────────────────────────
function closeModal(removeTemp = true) {
inputModal.close();
if (removeTemp && tempMarker) { map.removeLayer(tempMarker); tempMarker = null; }
pendingLatLng = null;
}
document.getElementById('btnCloseModal').addEventListener('click', () => closeModal());
document.getElementById('btnCancel').addEventListener('click', () => closeModal());
// Backdrop closes via method=dialog; cleanup state via 'close' event
inputModal.addEventListener('close', () => {
if (tempMarker) { map.removeLayer(tempMarker); tempMarker = null; }
pendingLatLng = null;
});
// ── SIMPAN DATA ────────────────────────────────────────────────────────
document.getElementById('btnSimpan').addEventListener('click', function () {
const nama = document.getElementById('namaSPBU').value.trim();
const nomor = document.getElementById('nomorSPBU').value.trim();
const status = document.getElementById('statusSPBU').value;
if (!nama) { document.getElementById('namaSPBU').focus(); showToast('Nama SPBU tidak boleh kosong!', 'error'); return; }
if (!nomor) { document.getElementById('nomorSPBU').focus(); showToast('Nomor SPBU tidak boleh kosong!', 'error'); return; }
if (!status) { document.getElementById('statusSPBU').focus(); showToast('Pilih status operasional!', 'error'); return; }
const btn = document.getElementById('btnSimpan');
btn.disabled = true;
btn.innerHTML = '<span class="loading loading-spinner loading-sm"></span> Menyimpan...';
fetch(API, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ nama_spbu: nama, nomor_spbu: nomor, status,
latitude: pendingLatLng.lat, longitude: pendingLatLng.lng })
})
.then(r => r.json())
.then(res => {
btn.disabled = false;
btn.innerHTML = '<i class="fa-solid fa-floppy-disk"></i> Simpan';
if (res.success) {
if (tempMarker) map.removeLayer(tempMarker);
tempMarker = null;
addSpbuMarker({ id: res.id, nama_spbu: nama, nomor_spbu: nomor, status,
latitude: pendingLatLng.lat, longitude: pendingLatLng.lng });
const entry = spbuMap.get(parseInt(res.id));
if (entry) entry.marker.openPopup();
inputModal.close();
pendingLatLng = null;
showToast('Data SPBU berhasil disimpan! ✅', 'success');
} else {
showToast('Gagal menyimpan: ' + (res.message || 'Error server'), 'error');
}
})
.catch(() => {
btn.disabled = false;
btn.innerHTML = '<i class="fa-solid fa-floppy-disk"></i> Simpan';
showToast('Tidak dapat terhubung ke server!', 'error');
});
});
// ── TOAST ──────────────────────────────────────────────────────────────
function showToast(msg, type = 'info') {
const t = document.createElement('div');
const cls = type === 'success' ? 'alert-success' : type === 'error' ? 'alert-error' : 'alert-info';
t.className = `alert ${cls} shadow-md`;
t.innerHTML = `<span>${msg}</span>`;
document.getElementById('toastContainer').appendChild(t);
setTimeout(() => t.remove(), 3500);
}
// ── EDIT MODAL ─────────────────────────────────────────────────────────
let editingId = null;
function openEditModal(id) {
const entry = spbuMap.get(id);
if (!entry) return;
editingId = id;
const { data } = entry;
document.getElementById('editNamaSPBU').value = data.nama_spbu;
document.getElementById('editNomorSPBU').value = data.nomor_spbu;
document.getElementById('editStatusSPBU').value = data.status;
document.getElementById('editCoordText').textContent =
`Lat: ${parseFloat(data.latitude).toFixed(6)}, Lng: ${parseFloat(data.longitude).toFixed(6)}`;
map.closePopup();
editModal.showModal();
setTimeout(() => document.getElementById('editNamaSPBU').focus(), 300);
}
function closeEditModal() { editModal.close(); editingId = null; }
document.getElementById('btnCloseEditModal').addEventListener('click', closeEditModal);
document.getElementById('btnCancelEdit').addEventListener('click', closeEditModal);
editModal.addEventListener('close', () => { editingId = null; });
document.getElementById('btnUpdate').addEventListener('click', function () {
const nama = document.getElementById('editNamaSPBU').value.trim();
const nomor = document.getElementById('editNomorSPBU').value.trim();
const status = document.getElementById('editStatusSPBU').value;
if (!nama) { showToast('Nama SPBU tidak boleh kosong!', 'error'); document.getElementById('editNamaSPBU').focus(); return; }
if (!nomor) { showToast('Nomor SPBU tidak boleh kosong!', 'error'); document.getElementById('editNomorSPBU').focus(); return; }
if (!status) { showToast('Pilih status operasional!', 'error'); document.getElementById('editStatusSPBU').focus(); return; }
const entry = spbuMap.get(editingId);
if (!entry) return;
const btn = document.getElementById('btnUpdate');
btn.disabled = true;
btn.innerHTML = '<span class="loading loading-spinner loading-sm"></span> Menyimpan...';
fetch(`${API}/${editingId}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: editingId, nama_spbu: nama, nomor_spbu: nomor, status,
latitude: parseFloat(entry.data.latitude),
longitude: parseFloat(entry.data.longitude)
})
})
.then(r => r.json())
.then(res => {
btn.disabled = false;
btn.innerHTML = '<i class="fa-solid fa-floppy-disk"></i> Perbarui';
if (res.success) {
const oldStatus = entry.data.status;
entry.data.nama_spbu = nama;
entry.data.nomor_spbu = nomor;
entry.data.status = status;
const color = status === 'Buka 24 Jam' ? LG_PRIMARY : LG_SECONDARY;
entry.marker.setIcon(createSpbuIcon(color));
entry.marker.setPopupContent(buildPopupContent(entry.data));
// Move to correct layer group if status changed
if (oldStatus !== status) {
const oldGroup = oldStatus === 'Buka 24 Jam' ? layer24h : layerRegular;
const newGroup = status === 'Buka 24 Jam' ? layer24h : layerRegular;
oldGroup.removeLayer(entry.marker);
newGroup.addLayer(entry.marker);
}
closeEditModal();
showToast('Data SPBU berhasil diperbarui! ✏️', 'success');
} else {
showToast('Gagal memperbarui: ' + (res.message || 'Error server'), 'error');
}
})
.catch(() => {
btn.disabled = false;
btn.innerHTML = '<i class="fa-solid fa-floppy-disk"></i> Perbarui';
showToast('Tidak dapat terhubung ke server!', 'error');
});
});
// ── DELETE CONFIRM ─────────────────────────────────────────────────────
let deletingId = null;
function openDeleteConfirm(id) {
const entry = spbuMap.get(id);
if (!entry) return;
deletingId = id;
document.getElementById('deleteSpbuName').textContent = entry.data.nama_spbu;
map.closePopup();
deleteModal.showModal();
}
function closeDeleteModal() { deleteModal.close(); deletingId = null; }
document.getElementById('btnCancelDelete').addEventListener('click', closeDeleteModal);
deleteModal.addEventListener('close', () => { deletingId = null; });
document.getElementById('btnConfirmDelete').addEventListener('click', function () {
if (!deletingId) return;
const entry = spbuMap.get(deletingId);
if (!entry) return;
const btn = document.getElementById('btnConfirmDelete');
btn.disabled = true;
btn.innerHTML = '<span class="loading loading-spinner loading-sm"></span> Menghapus...';
fetch(`${API}/${deletingId}`, {
method: 'DELETE',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: deletingId })
})
.then(r => r.json())
.then(res => {
btn.disabled = false;
btn.innerHTML = '<i class="fa-solid fa-trash"></i> Ya, Hapus';
if (res.success) {
map.removeLayer(entry.marker);
spbuMap.delete(deletingId);
closeDeleteModal();
showToast('Data SPBU berhasil dihapus! 🗑️', 'success');
} else {
showToast('Gagal menghapus: ' + (res.message || 'Error server'), 'error');
}
})
.catch(() => {
btn.disabled = false;
btn.innerHTML = '<i class="fa-solid fa-trash"></i> Ya, Hapus';
showToast('Tidak dapat terhubung ke server!', 'error');
});
});
</script>
</body>
</html>
File diff suppressed because one or more lines are too long
+9
View File
@@ -0,0 +1,9 @@
<?php
use App\Http\Controllers\SpbuController;
use Illuminate\Support\Facades\Route;
Route::get('/spbu', [SpbuController::class, 'index']);
Route::post('/spbu', [SpbuController::class, 'store']);
Route::put('/spbu/{spbu}', [SpbuController::class, 'update']);
Route::delete('/spbu/{spbu}', [SpbuController::class, 'destroy']);
+8
View File
@@ -0,0 +1,8 @@
<?php
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
+15
View File
@@ -0,0 +1,15 @@
<?php
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('home');
})->name('home');
Route::get('/input', function () {
return view('spbu.input');
})->name('spbu.input');
Route::get('/data', function () {
return view('spbu.index');
})->name('spbu.data');
+4
View File
@@ -0,0 +1,4 @@
*
!private/
!public/
!.gitignore
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+9
View File
@@ -0,0 +1,9 @@
compiled.php
config.php
down
events.scanned.php
maintenance.php
routes.php
routes.scanned.php
schedule-*
services.json
+3
View File
@@ -0,0 +1,3 @@
*
!data/
!.gitignore
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+2
View File
@@ -0,0 +1,2 @@
*
!.gitignore
+18
View File
@@ -0,0 +1,18 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
tailwindcss(),
],
server: {
watch: {
ignored: ['**/storage/framework/views/**'],
},
},
});