Compare commits

...

102 Commits
main ... baru

Author SHA1 Message Date
Farhaan4
05343a5cb9 rsvp 2025-10-24 17:05:32 +07:00
510651f7ed Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-24 16:43:57 +07:00
3b6063d8c5 premium 2025-10-24 16:43:47 +07:00
bdcd09edf8 [Update] 2025-10-24 16:38:23 +07:00
579f1c21b5 [Update] 2025-10-24 15:25:55 +07:00
38d83192c3 [Update] desain basic 2025-10-24 14:40:19 +07:00
f044a14fa2 khitanbasic 2025-10-24 09:20:03 +07:00
9ca4fa2670 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-23 15:07:31 +07:00
8fed239e16 asset foto 2025-10-23 15:07:12 +07:00
Farhaan4
84965cc97b templates - kategori 2025-10-23 13:58:50 +07:00
0b27ccd567 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-23 11:24:35 +07:00
1e5c75f1dc [Update] code palanggan 2025-10-23 11:24:10 +07:00
Farhaan4
e7e03e7a55 tes rsvp 2025-10-23 11:16:51 +07:00
Farhaan4
cf807861cb rsvp 2025-10-23 10:55:14 +07:00
Farhaan4
65508033d0 share link daftar-tamu 2025-10-23 10:10:33 +07:00
Baghaztra
8d84a54e79 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-22 17:09:53 +07:00
Baghaztra
8ac27da65b [Update] Guest 2025-10-22 17:09:41 +07:00
ec536ccecc Basic 2025-10-22 16:34:06 +07:00
566f3c0df8 [Update] Starter ultah 2025-10-22 16:30:44 +07:00
c4b482b514 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-21 14:10:56 +07:00
ae54584440 [index] khitan basic 2025-10-21 14:10:51 +07:00
478c043278 basic 2025-10-21 14:10:46 +07:00
bd176aad5c [Khitan] Starter 2025-10-21 11:00:23 +07:00
b343fd7b01 [khitan] basic 2025-10-21 10:07:40 +07:00
d243546a2c Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-20 16:14:50 +07:00
4d2b61d05b [Update]starter 2025-10-20 16:14:34 +07:00
Farhaan4
b3c659bd58 khitan 2025-10-20 15:42:05 +07:00
83f60371cd [Update] 2025-10-20 15:29:12 +07:00
Farhaan4
19790cdc29 fix form khitan prem 2025-10-20 11:08:37 +07:00
3ab06a82e6 fix 2025-10-20 09:46:42 +07:00
6d68f5eaf3 Minions 2025-10-20 09:43:00 +07:00
764732a3b7 [Ultah]Basic 2025-10-17 14:30:37 +07:00
Farhaan4
4c467488fb update form premium 2025-10-16 11:29:26 +07:00
Farhaan4
3b42e905d3 form pernikahan prem 2025-10-16 10:46:22 +07:00
a89b5c2cb7 fix 2025-10-16 10:23:27 +07:00
dd75f12217 [Update] form khitan 2025-10-16 10:06:15 +07:00
82f74c3a3b Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-15 19:18:28 +07:00
a4724c6cff p 2025-10-15 19:17:05 +07:00
Farhaan4
6bb0e98021 pop up form premium 2025-10-15 16:47:07 +07:00
b27f6a47fb add 2025-10-15 16:19:49 +07:00
Farhaan4
8dbe97a4b0 update template ultah 2025-10-15 15:33:06 +07:00
2d4657067a Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-15 13:00:18 +07:00
Farhaan4
6f96b18126 update form premium 2025-10-15 11:24:41 +07:00
763e571cf6 fix 2025-10-15 11:00:46 +07:00
caea0f2873 [View] Show Blade 2025-10-15 10:47:35 +07:00
ab8d7b4a3c add dashboard 2025-10-15 10:26:48 +07:00
Farhaan4
d2b2db90a6 fix kategori 2025-10-14 11:37:54 +07:00
Farhaan4
28d3155070 fix landing page 2025-10-14 10:23:15 +07:00
Baghaztra
40e8b59001 [Update] preview 2025-10-13 16:05:32 +07:00
Baghaztra
e9c33e0fc9 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-13 15:58:07 +07:00
Baghaztra
726f990084 [Feat] Preview template 2025-10-13 15:57:24 +07:00
055b8b2082 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-13 15:43:32 +07:00
dc6c0ce920 fix 2025-10-13 15:43:25 +07:00
Farhaan4
9be255c4d8 tes design template 2025-10-13 15:41:26 +07:00
dhilanradya
9faed9a803 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-13 15:25:51 +07:00
eb29210173 khitan form 2025-10-13 15:24:54 +07:00
dhilanradya
1918987187 [feet] undangan ulang tahun starter + basic 2025-10-13 15:24:48 +07:00
timotiabbauftech
bba8a3d7a9 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-13 14:15:17 +07:00
timotiabbauftech
4c473379e3 feat Undangan basic dan undangan starter 2025-10-13 14:15:12 +07:00
dhilanradya
23ae9529bb Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-13 13:34:19 +07:00
dhilanradya
ec192c588a [update] undangan ulang tahun premium 2025-10-13 13:34:07 +07:00
18303628e8 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-13 11:10:36 +07:00
15481060d0 khitan form 2025-10-13 11:10:17 +07:00
timotiabbauftech
b8549fbe7e Update undangan-pernikahan-premium.vue 2025-10-13 10:52:07 +07:00
Baghaztra
4ce07faf34 [Update] working flow pemesanan 2025-10-13 10:24:05 +07:00
Baghaztra
21afb74337 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-13 10:11:42 +07:00
Baghaztra
a76226ac08 [update] controller 2025-10-13 10:11:38 +07:00
b3d1917501 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-13 09:47:09 +07:00
bb4bf10e52 [Update Template Seeder] 2025-10-13 09:46:57 +07:00
timotiabbauftech
1ae8f29bae Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-13 09:38:14 +07:00
timotiabbauftech
c2fcb9e22e Update undangan-pernikahan-premium.vue 2025-10-13 09:38:10 +07:00
dhilanradya
e085adadcb Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-09 16:11:00 +07:00
dhilanradya
08390be353 [feet] form undangan ulang tahun premium sementara 2025-10-09 16:10:55 +07:00
Farhaan4
23c8e909ca kategori templat 2025-10-09 15:02:52 +07:00
Baghaztra
53aa75b809 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-09 14:18:00 +07:00
Baghaztra
5f7c976cb4 [feat] Link undangan frontend 2025-10-09 14:17:57 +07:00
timotiabbauftech
788d8e3ef2 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-09 13:53:54 +07:00
timotiabbauftech
522146627e belum 2025-10-09 13:53:48 +07:00
e7f01dec0b Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-09 13:28:14 +07:00
957ed826c0 [Update Seeder & Logo] 2025-10-09 13:28:04 +07:00
timotiabbauftech
eb2ba50ac9 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-09 11:48:13 +07:00
timotiabbauftech
e341425b27 Create undangan-pernikahan-premium.vue 2025-10-09 11:48:06 +07:00
Baghaztra
992b3e735a Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-09 11:41:43 +07:00
Baghaztra
9b0df7266b [feat] undangan 2025-10-09 11:41:30 +07:00
472f385b65 [SeederPelanggan] 2025-10-09 11:39:47 +07:00
7598b2d3eb [Invitetion Code] 2025-10-09 11:12:25 +07:00
50e9ba339e [Update Temlete] 2025-10-09 10:22:51 +07:00
Baghaztra
0110d6275f [feat] slug 2025-10-09 10:20:05 +07:00
Farhaan4
47ad559659 featured templates 2025-10-09 09:16:27 +07:00
3da77dad53 [Update Seeder] 2025-10-07 16:28:32 +07:00
b23448b4ad fix desain 2025-10-07 14:12:58 +07:00
Farhaan4
9fd4dac382 tes 2025-10-07 10:52:14 +07:00
Farhaan4
1ef83feac9 Merge branch 'baru' of https://git.abbauf.com/Magang-2025/Undangan into baru 2025-10-07 10:43:04 +07:00
Farhaan4
ce4e10f3ac form pernikahan 2025-10-07 10:36:44 +07:00
f39f510bda add desain & fix bug 2025-10-07 09:54:17 +07:00
54c237d211 fix 2025-10-03 14:15:04 +07:00
97d79b4a84 [Api Template & Kategori] 2025-10-03 11:18:16 +07:00
e4ffa61083 fix 2025-10-03 10:41:47 +07:00
a79a804b68 fix fix 2025-10-03 10:41:35 +07:00
982bd80e8f add dashboard 2025-10-02 17:06:45 +07:00
64d5c96518 [Update controller] 2025-10-02 15:59:52 +07:00
e1d2a130f7 [terbaru] 2025-10-02 14:20:41 +07:00
235 changed files with 30304 additions and 1651 deletions

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
[docker-compose.yml]
indent_size = 4

58
backend-baru/.env.example Normal file
View File

@ -0,0 +1,58 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=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
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

11
backend-baru/.gitattributes vendored Normal file
View File

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

18
backend-baru/.gitignore vendored Normal file
View File

@ -0,0 +1,18 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode

66
backend-baru/README.md Normal file
View File

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

View File

@ -0,0 +1,27 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of exception types with their corresponding custom log levels.
*
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
*/
protected $levels = [
//
];
/**
* A list of the exception types that are not reported.
*
* @var array<int, class-string<\Throwable>>
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];
/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
});
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class AdminAuthController extends Controller
{
public function showLogin()
{
return view('admin.auth.login');
}
public function login(Request $request)
{
$credentials = $request->validate([
'email' => ['required','email'],
'password' => ['required'],
]);
$remember = $request->boolean('remember');
if (Auth::guard('admin')->attempt($credentials, $remember)) {
$request->session()->regenerate();
return redirect()->intended(route('admin.dashboard'));
}
return back()->withErrors([
'email' => 'Email atau password salah.',
])->onlyInput('email');
}
public function logout(Request $request)
{
Auth::guard('admin')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect()->route('admin.login');
}
}

View File

@ -0,0 +1,137 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Guest;
use App\Models\Pelanggan;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
class GuestApiController extends Controller
{
public function index(string $code)
{
$pelanggan = Pelanggan::where('kode_pelanggan', $code)->first();
if (!$pelanggan) {
return response()->json([
'success' => false,
'message' => 'Pelanggan tidak ditemukan.',
], 404);
}
if ($pelanggan->status !== 'diterima') {
return response()->json([
'success' => false,
'message' => 'Pesanan belum diterima.',
], 400);
}
$guests = Guest::where('id_pelanggan', $pelanggan->id)->get();
return response()->json([
'success' => true,
'data' => $guests,
]);
}
public function store(Request $request)
{
try {
$validated = $request->validate([
'kode_pelanggan' => 'required|exists:pelanggans,kode_pelanggan',
'nama_tamu' => 'required|string|max:255',
]);
$pelanggan = Pelanggan::where('kode_pelanggan', $validated['kode_pelanggan'])->firstOrFail();
$jumlah_tamu = Guest::where('id_pelanggan', $pelanggan->id)->count();
$paket = $pelanggan->template->paket;
if ($paket === 'starter' && $jumlah_tamu >= 10) {
return response()->json([
'success' => false,
'message' => 'Batas tamu untuk paket starter adalah 10.',
], 400);
} elseif ($paket === 'basic' && $jumlah_tamu >= 20) {
return response()->json([
'success' => false,
'message' => 'Batas tamu untuk paket Basic adalah 20.',
], 400);
} elseif ($paket === 'premium' && $jumlah_tamu >= 30) {
return response()->json([
'success' => false,
'message' => 'Batas tamu untuk paket Premium adalah 30.',
], 400);
}
// cek anunya udah diterima
if ($pelanggan->status !== 'diterima') {
return response()->json([
'success' => false,
'message' => 'Pesanan belum diterima.',
], 400);
}
$guest = Guest::create([
'id_pelanggan' => $pelanggan->id,
'nama_tamu' => $validated['nama_tamu'],
'kode_invitasi' => 'INV-' . strtoupper(Str::random(6)),
]);
return response()->json([
'success' => true,
'data' => $guest,
], 201);
} catch (\Illuminate\Validation\ValidationException $e) {
return response()->json([
'success' => false,
'message' => 'Validation failed',
'errors' => $e->errors(),
], 422);
}
}
public function destroy(int $id)
{
$guest = Guest::find($id);
if (!$guest) {
return response()->json([
'success' => false,
'message' => 'Tamu tidak ditemukan.',
], 404);
}
try {
$guest->delete();
return response()->json([
'success' => true,
'message' => 'Tamu berhasil dihapus.',
], 200);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'message' => 'Gagal menghapus tamu.',
], 500);
}
}
// Ambil undangan berdasarkan invitation code
public function getByInvitationCode($code)
{
$data = Guest::with('pelanggan.template', 'pelanggan.rsvp')
->where('kode_invitasi', $code)
->first();
if (!$data) {
return response()->json([
'success' => false,
'message' => 'Data undangan tidak ditemukan.',
], 404);
}
return response()->json([
'success' => true,
'data' => $data,
]);
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Kategori;
class KategoriApiController extends Controller
{
// Ambil semua kategori
public function index()
{
// 1. Ambil semua kategori dari database
$kategoris = Kategori::all();
// 2. Ubah koleksi data untuk membuat URL foto yang benar
$transformedKategoris = $kategoris->map(function($kategori) {
return [
'id' => $kategori->id,
'nama' => $kategori->nama,
'deskripsi' => $kategori->deskripsi,
// Gunakan helper asset() untuk membuat URL lengkap
'foto' => $kategori->foto ? asset('storage/' . $kategori->foto) : null,
];
});
// 3. Kirim data yang sudah diubah sebagai JSON
return response()->json($transformedKategoris);
}
// Ambil detail satu kategori
public function show(Kategori $kategori)
{
// Sebaiknya detail juga diubah agar konsisten
return response()->json([
'id' => $kategori->id,
'nama' => $kategori->nama,
'deskripsi' => $kategori->deskripsi,
'foto' => asset('storage/' . $kategori->foto),
]);
}
}

View File

@ -0,0 +1,135 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Guest;
use App\Models\Pelanggan;
use App\Models\Template;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
class PelangganApiController extends Controller
{
// 🔹 Simpan pesanan pelanggan via API
public function store(Request $request)
{
try {
$validated = $request->validate([
'nama_pemesan' => 'required|string|max:255',
'email' => 'required|email',
'no_tlpn' => 'required|string|max:20',
'template_slug' => 'required|exists:templates,slug',
'form' => 'required|array',
'foto.*' => 'nullable|image|mimes:jpeg,png,jpg|max:2048',
]);
$template = Template::where('slug', $request->input('template_slug'))->firstOrFail();
// Generate unique customer code
$customerCode = 'CUST-' . strtoupper(Str::random(6));
while (Pelanggan::where('kode_pelanggan', $customerCode)->exists()) {
$customerCode = 'CUST-' . strtoupper(Str::random(6));
}
// Handle file uploads
$fotoPaths = [];
if ($request->hasFile('foto')) {
foreach ($request->file('foto') as $file) {
$path = $file->store('photos', 'public'); // Store in storage/public/photos
$fotoPaths[] = $path;
}
}
// Save customer data
$pelanggan = Pelanggan::create([
'nama_pemesan' => $validated['nama_pemesan'],
'email' => $validated['email'],
'no_tlpn' => $validated['no_tlpn'],
'template_id' => $template->id,
'form' => array_merge($validated['form'], ['foto' => $fotoPaths]),
'harga' => $template->harga,
'status' => 'menunggu',
'kode_pelanggan' => $customerCode,
]);
return response()->json([
'success' => true,
'message' => 'Pesanan berhasil dibuat',
'data' => $pelanggan,
], 201);
} catch (\Illuminate\Validation\ValidationException $e) {
return response()->json([
'success' => false,
'message' => 'Validation failed',
'errors' => $e->errors(),
], 422);
} catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
return response()->json([
'success' => false,
'message' => 'Template not found',
], 404);
} catch (\Exception $e) {
Log::error('Error in store method: ' . $e->getMessage());
return response()->json([
'success' => false,
'message' => 'An error occurred: ' . $e->getMessage(),
], 500);
}
}
// 🔹 Ambil semua data pelanggan
public function index()
{
$pelanggan = Pelanggan::with('template')->latest()->get();
return response()->json([
'success' => true,
'data' => $pelanggan,
]);
}
// 🔹 Ambil pesanan berdasarkan ID
public function show($id)
{
$pelanggan = Pelanggan::with('template')->find($id);
if (!$pelanggan) {
return response()->json([
'success' => false,
'message' => 'Data pelanggan tidak ditemukan.',
], 404);
}
return response()->json([
'success' => true,
'data' => $pelanggan,
]);
}
// 🔹 Update status pesanan (opsional untuk admin mobile)
public function updateStatus(Request $request, $id)
{
$request->validate([
'status' => 'required|in:menunggu,diterima,ditolak',
]);
$pelanggan = Pelanggan::find($id);
if (!$pelanggan) {
return response()->json([
'success' => false,
'message' => 'Pesanan tidak ditemukan.',
], 404);
}
$pelanggan->update(['status' => $request->status]);
return response()->json([
'success' => true,
'message' => 'Status pesanan berhasil diperbarui.',
'data' => $pelanggan,
]);
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Review;
class ReviewApiController extends Controller
{
// Ambil semua ulasan (JSON)
public function index()
{
$reviews = Review::latest()->get();
return response()->json($reviews, 200);
}
// Simpan ulasan baru
public function store(Request $request)
{
$validated = $request->validate([
'rating' => 'required|integer|min:1|max:5',
'message' => 'required|string',
'name' => 'required|string|max:100',
'city' => 'required|string|max:100',
]);
$review = Review::create($validated);
return response()->json([
'message' => 'Ulasan berhasil disimpan',
'data' => $review,
], 201);
}
// Tampilkan ulasan tertentu
public function show($id)
{
$review = Review::findOrFail($id);
return response()->json($review, 200);
}
// Hapus ulasan
public function destroy($id)
{
$review = Review::findOrFail($id);
$review->delete();
return response()->json([
'message' => 'Ulasan berhasil dihapus',
], 200);
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Review;
class ReviewController extends Controller
{
// Ambil semua ulasan
public function index()
{
$reviews = Review::latest()->paginate(10);
return view('admin.reviews.index', compact('reviews'));
}
// Simpan ulasan baru
public function store(Request $request)
{
$validated = $request->validate([
'rating' => 'required|integer|min:1|max:5',
'message' => 'required|string',
'name' => 'required|string|max:100',
'city' => 'required|string|max:100',
]);
$review = Review::create($validated);
return response()->json([
'message' => 'Ulasan berhasil disimpan',
'data' => $review
], 201);
}
// Tampilkan ulasan tertentu
public function show($id)
{
$review = Review::findOrFail($id);
return response()->json($review, 200);
}
// Hapus ulasan
public function destroy($id)
{
$review = Review::findOrFail($id);
$review->delete();
return response()->json([
'message' => 'Ulasan berhasil dihapus'
], 200);
}
}

View File

@ -0,0 +1,78 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Guest;
use App\Models\Rsvp;
use Illuminate\Http\Request;
class RsvpApiController extends Controller
{
// 🔹 Simpan RSVP berdasarkan kode_invitasi (POST)
public function store(Request $request, $kodeInvitasi)
{
try {
$validated = $request->validate([
'nama' => 'required|string|max:255',
'pesan' => 'required|string',
'status_kehadiran' => 'required|in:hadir,tidak_hadir,mungkin',
]);
$guest = Guest::where('kode_invitasi', $kodeInvitasi)->first();
if (!$guest) {
return response()->json([
'success' => false,
'message' => 'Kode invitasi tidak ditemukan.',
], 404);
}
$rsvp = Rsvp::create([
'guest_id' => $guest->id,
'nama' => $validated['nama'],
'pesan' => $validated['pesan'],
'status_kehadiran' => $validated['status_kehadiran'],
]);
return response()->json([
'success' => true,
'message' => 'RSVP berhasil disimpan',
'data' => $rsvp,
], 201);
} catch (\Illuminate\Validation\ValidationException $e) {
return response()->json([
'success' => false,
'message' => 'Validasi gagal',
'errors' => $e->errors(),
], 422);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'message' => 'Gagal menyimpan RSVP.',
], 500);
}
}
// 🔹 Ambil semua RSVP berdasarkan kode_invitasi (GET)
public function index($kodeInvitasi)
{
$guest = Guest::where('kode_invitasi', $kodeInvitasi)->first();
if (!$guest) {
return response()->json([
'success' => false,
'message' => 'Kode invitasi tidak ditemukan.',
], 404);
}
$rsvps = Rsvp::where('guest_id', $guest->id)->get();
return response()->json([
'success' => true,
'message' => 'Data RSVP ditemukan',
'data' => $rsvps,
]);
}
}

View File

@ -0,0 +1,99 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Template;
class TemplateApiController extends Controller
{
// Ambil semua template
public function index()
{
$templates = Template::with('kategori')->get();
$transformedTemplates = $templates->map(function ($template) {
return [
'id' => $template->id,
'nama_template' => $template->nama_template,
'slug' => $template->slug,
'harga' => $template->harga,
'paket' => $template->paket,
'kategori' => $template->kategori ? $template->kategori->nama : null,
'foto' => $template->foto ? asset('storage/' . $template->foto) : null,
];
});
return response()->json($transformedTemplates);
}
// Ambil detail template tertentu
public function show(Template $template)
{
// Jika ada query ?with_dummy=true, tambahkan dummy value
$formData = $this->addDummyValues($template->form ?? []);
return response()->json([
'id' => $template->id,
'nama_template' => $template->nama_template,
'slug' => $template->slug,
'harga' => $template->harga,
'paket' => $template->paket,
'kategori' => $template->kategori ? $template->kategori->nama : null,
'form' => $formData,
'foto' => $template->foto ? asset('storage/' . $template->foto) : null,
]);
}
private function addDummyValues(array $form)
{
if (empty($form['fields'])) {
return $form;
}
// Aturan dummy value berdasarkan tipe
$dummyValues = [
'text' => 'XXXXX XXXX',
'email' => 'example@domain.com',
'textarea' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'date' => '2025-12-01',
'datetime-local' => '2025-12-01T09:00',
'number' => 17,
'file' => null,
'url' => 'https://example.com',
];
// Map field untuk menambahkan dummy value
$form['fields'] = array_map(function ($field) use ($dummyValues) {
$field['value'] = $dummyValues[$field['type']] ?? 'Unknown Type';
return $field;
}, $form['fields']);
return $form;
}
public function getByCategory($id)
{
$templates = Template::with('kategori')
->where('kategori_id', $id)
->get();
$transformed = $templates->map(function ($template) {
return [
'id' => $template->id,
'nama_template' => $template->nama_template,
'harga' => $template->harga,
'paket' => $template->paket,
'kategori' => $template->kategori ? [
'id' => $template->kategori->id,
'nama' => $template->kategori->nama
] : null,
'foto' => $template->foto ? asset('storage/' . $template->foto) : null,
'fiturs' => $template->fiturs ?? [],
];
});
return response()->json($transformed);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, ValidatesRequests;
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers;
use App\Models\Kategori;
use App\Models\Template;
use App\Models\Pelanggan;
use Illuminate\Http\Request;
class DashboardController extends Controller
{
public function index()
{
// Hitung total data
$totalKategori = Kategori::count();
$totalTemplate = Template::count();
$totalPelanggan = Pelanggan::count();
// Ambil pelanggan terbaru (misal 5 terakhir)
$pelangganTerbaru = Pelanggan::with(['template.kategori'])
->latest()
->take(5)
->get();
return view('admin.dashboard', compact(
'totalKategori',
'totalTemplate',
'totalPelanggan',
'pelangganTerbaru'
));
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Models\Kategori;
use Illuminate\Http\Request;
class KategoriController extends Controller
{
public function index()
{
$kategori = Kategori::all();
return view('admin.kategori.index', compact('kategori'));
}
public function create()
{
return view('admin.kategori.create');
}
public function store(Request $request)
{
$data = $request->validate([
'nama' => 'required|string|max:255',
'deskripsi' => 'nullable|string',
'foto' => 'nullable|image|mimes:jpg,jpeg,png,gif|max:5120',
]);
if ($request->hasFile('foto')) {
$data['foto'] = $request->file('foto')->store('kategori', 'public');
}
Kategori::create($data);
return redirect()->route('admin.kategori.index')->with('success', 'Kategori berhasil ditambahkan!');
}
public function edit(Kategori $kategori)
{
return view('admin.kategori.edit', compact('kategori'));
}
public function update(Request $request, Kategori $kategori)
{
$data = $request->validate([
'nama' => 'required|string|max:255',
'deskripsi' => 'nullable|string',
'foto' => 'nullable|image|mimes:jpg,jpeg,png,gif|max:5120',
]);
if ($request->hasFile('foto')) {
$data['foto'] = $request->file('foto')->store('kategori', 'public');
}
$kategori->update($data);
return redirect()->route('admin.kategori.index')->with('success', 'Kategori berhasil diperbarui!');
}
public function destroy(Kategori $kategori)
{
$kategori->delete();
return redirect()->route('admin.kategori.index')->with('success', 'Kategori berhasil dihapus!');
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace App\Http\Controllers;
use App\Models\Pelanggan;
use App\Models\Template;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
class PelangganController extends Controller
{
// 🔹 Tampilkan daftar pesanan (admin)
public function index()
{
$pelanggans = Pelanggan::with('template')->latest()->paginate(10);
return view('admin.pelanggans.index', compact('pelanggans'));
}
// 🔹 Tampilkan detail pesanan (admin)
public function show($id)
{
$pelanggan = Pelanggan::with('template')->findOrFail($id);
return view('admin.pelanggans.show', compact('pelanggan'));
}
// 🔹 Tampilkan detail pesanan berdasarkan invitation code
public function showByCode($code)
{
$pelanggan = Pelanggan::with('template')
->where('invitation_code', $code)
->firstOrFail();
return view('admin.pelanggans.show', compact('pelanggan'));
}
// 🔹 Pelanggan membuat pesanan (frontend user)
public function store(Request $request)
{
$template = Template::findOrFail($request->input('template_id'));
$rules = [
'nama_pemesan' => 'required|string|max:255',
'email' => 'required|email',
'no_tlpn' => 'required|string|max:30',
'template_id' => 'required|exists:templates,id',
];
// 🔸 Validasi dinamis dari JSON form template
if ($template->form) {
foreach ($template->form as $field => $options) {
$rule = [];
$rule[] = !empty($options['required']) ? 'required' : 'nullable';
$rule[] = 'string';
$rules["form.$field"] = implode('|', $rule);
}
}
$validated = $request->validate($rules);
// 🔸 Generate kode undangan unik
// 🔸 Generate kode pelanggan unik (contoh: CUST-DJ3TJG)
$kodePelanggan = 'CUST-' . strtoupper(Str::random(6));
while (Pelanggan::where('kode_pelanggan', $kodePelanggan)->exists()) {
$kodePelanggan = 'CUST-' . strtoupper(Str::random(6));
}
// 🔸 Simpan pesanan baru
$pelanggan = Pelanggan::create([
'nama_pemesan' => $validated['nama_pemesan'],
'email' => $validated['email'],
'no_tlpn' => $validated['no_tlpn'],
'template_id' => $template->id,
'form' => $request->input('form'),
'harga' => $template->harga,
'status' => 'menunggu',
'invitation_code' => $invitationCode,
]);
return redirect()->route('pelanggans.show', $pelanggan->id)
->with('success', 'Pesanan berhasil dikirim, status menunggu konfirmasi admin.');
}
// 🔹 Update status pesanan (admin)
public function update(Request $request, $id)
{
$pelanggan = Pelanggan::findOrFail($id);
$validated = $request->validate([
'status' => 'required|in:menunggu,diterima,ditolak',
]);
$pelanggan->update($validated);
return redirect()->back()->with('success', 'Status pesanan berhasil diperbarui.');
}
// 🔹 Hapus pesanan (admin)
public function destroy($id)
{
$pelanggan = Pelanggan::findOrFail($id);
$pelanggan->delete();
return redirect()->route('admin.pelanggans.index')
->with('success', 'Pesanan berhasil dihapus.');
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Pelanggan;
use App\Models\Rsvp;
class RsvpController extends Controller
{
// 🔹 Simpan data RSVP (POST)
public function store(Request $request, $invitationCode)
{
$pelanggan = Pelanggan::where('invitation_code', $invitationCode)->first();
if (!$pelanggan) {
return response()->json(['message' => 'Kode undangan tidak ditemukan'], 404);
}
$rsvp = Rsvp::create([
'pelanggan_id' => $pelanggan->id,
'nama' => $request->nama,
'pesan' => $request->pesan,
'status_kehadiran' => $request->status_kehadiran,
]);
return response()->json([
'message' => 'RSVP berhasil disimpan',
'data' => $rsvp,
]);
}
// 🔹 Ambil semua RSVP berdasarkan kode undangan (GET)
public function show($invitationCode)
{
$pelanggan = Pelanggan::where('invitation_code', $invitationCode)->first();
if (!$pelanggan) {
return response()->json(['message' => 'Kode undangan tidak ditemukan'], 404);
}
$rsvp = Rsvp::where('pelanggan_id', $pelanggan->id)->get();
return response()->json([
'message' => 'Data RSVP ditemukan',
'data' => $rsvp
]);
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\Http\Controllers;
use App\Models\Template;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class TemplateController extends Controller
{
// Lihat semua template (untuk admin web)
public function index()
{
$templates = Template::with('kategori')->get();
return view('admin.template.index', compact('templates'));
}
// Form edit (ubah data template)
public function edit(Template $template)
{
return view('admin.template.edit', compact('template'));
}
// Update template (nama, harga, paket, foto)
public function update(Request $request, Template $template)
{
$validated = $request->validate([
'nama_template' => 'required|string|max:255',
'harga' => 'required|numeric|min:0',
'foto' => 'nullable|image|mimes:jpg,jpeg,png|max:5120',
]);
// kalau ada upload foto baru
if ($request->hasFile('foto')) {
if ($template->foto && Storage::exists('public/' . $template->foto)) {
Storage::delete('public/' . $template->foto);
}
$path = $request->file('foto')->store('templates', 'public');
$validated['foto'] = $path;
}
// pastikan 'paket' tidak diubah
$validated['paket'] = $template->paket;
$template->update($validated);
return redirect()->route('admin.template.index')
->with('success', 'Template berhasil diperbarui!');
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's middleware aliases.
*
* Aliases may be used to conveniently assign middleware to routes and groups.
*
* @var array<string, class-string|string>
*/
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
*/
protected function redirectTo(Request $request): ?string
{
return $request->expectsJson() ? null : route('login');
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array<int, string>
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array<int, string>
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Middleware;
use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next, string ...$guards): Response
{
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
}
}
return $next($request);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array<int, string>
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustHosts as Middleware;
class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array<int, string|null>
*/
public function hosts(): array
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array<int, string>|string|null
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var int
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
class ValidateSignature extends Middleware
{
/**
* The names of the query string parameters that should be ignored.
*
* @var array<int, string>
*/
protected $except = [
// 'fbclid',
// 'utm_campaign',
// 'utm_content',
// 'utm_medium',
// 'utm_source',
// 'utm_term',
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array<int, string>
*/
protected $except = [
//
];
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class Admin extends Authenticatable
{
use Notifiable;
protected $fillable = ['name','email','password'];
protected $hidden = ['password','remember_token'];
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Guest extends Model
{
use HasFactory;
protected $fillable = [
'id_pelanggan',
'nama_tamu',
'kode_invitasi',
];
public function pelanggan()
{
return $this->belongsTo(Pelanggan::class, 'id_pelanggan');
}
public function rsvps()
{
return $this->hasMany(Rsvp::class);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Kategori extends Model
{
use HasFactory;
protected $table = 'kategoris';
protected $fillable = [
'nama',
'deskripsi',
'foto',
];
// Relasi ke Template
public function templates()
{
return $this->hasMany(Template::class, 'kategori_id');
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Pelanggan extends Model
{
use HasFactory;
protected $table = 'pelanggans';
protected $fillable = [
'nama_pemesan',
'email',
'no_tlpn',
'template_id',
'form',
'harga',
'status',
'kode_pelanggan',
];
protected $casts = [
'form' => 'array',
'harga' => 'decimal:2',
];
public function template()
{
return $this->belongsTo(Template::class, 'template_id');
}
public function guests()
{
return $this->hasMany(Guest::class, 'id_pelanggan');
}
public function rsvp()
{
return $this->hasManyThrough(
Rsvp::class,
Guest::class,
'id_pelanggan',
'guest_id',
'id',
'id'
);
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Review extends Model
{
use HasFactory;
protected $fillable = [
'rating',
'message',
'name',
'city',
];
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Rsvp extends Model
{
use HasFactory;
protected $fillable = ['guest_id', 'nama', 'pesan', 'status_kehadiran'];
public function guest() {
return $this->belongsTo(Guest::class);
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Template extends Model
{
use HasFactory;
protected $table = 'templates';
protected $fillable = [
'nama_template',
'harga',
'foto',
'paket',
'form',
'kategori_id',
];
protected $casts = [
'form' => 'array',
'harga' => 'decimal:2',
];
protected $appends = ['slug'];
// Relasi ke Kategori
public function kategori()
{
return $this->belongsTo(Kategori::class, 'kategori_id');
}
// Relasi ke Pelanggan
public function pelanggans()
{
return $this->hasMany(Pelanggan::class, 'template_id');
}
// Accessor untuk slug
public function getSlugAttribute()
{
return Str::slug($this->nama_template);
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}

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
{
//
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Providers;
// use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*/
public function boot(): void
{
$this->registerPolicies();
//
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
/**
* Register any events for your application.
*/
public function boot(): void
{
//
}
/**
* Determine if events and listeners should be automatically discovered.
*/
public function shouldDiscoverEvents(): bool
{
return false;
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* The path to the "home" route for your application.
*
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = '/home';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*/
public function boot(): void
{
$this->configureRateLimiting();
$this->routes(function () {
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
/**
* Configure the rate limiters for the application.
*/
protected function configureRateLimiting(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
}
}

53
backend-baru/artisan Normal file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env php
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any of our classes manually. It's great to relax.
|
*/
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running, we will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);

View File

@ -0,0 +1,55 @@
<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;

View File

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

View File

@ -0,0 +1,68 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.1",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.0",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"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"
]
},
"extra": {
"branch-alias": {
"dev-master": "10.x-dev"
},
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

8250
backend-baru/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

215
backend-baru/config/app.php Normal file
View File

@ -0,0 +1,215 @@
<?php
use Illuminate\Support\Facades\Facade;
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'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
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', '/'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| 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' => 'file',
// 'store' => 'redis',
],
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => Facade::defaultAliases()->merge([
// 'ExampleClass' => App\Example\ExampleClass::class,
])->toArray(),
];

View File

@ -0,0 +1,55 @@
<?php
return [
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
// Tambahkan guard admin di sini
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
// Tambahkan provider admins di sini
'admins' => [
'driver' => 'eloquent',
'model' => App\Models\Admin::class,
],
],
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
],
// Tambahkan konfigurasi password reset untuk admin
'admins' => [
'provider' => 'admins',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
],
],
'password_timeout' => 10800,
];

View File

@ -0,0 +1,70 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

View File

@ -0,0 +1,110 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| 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: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'file' => [
'driver' => 'file',
'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' => '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',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, or 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(env('APP_NAME', 'laravel'), '_').'_cache_'),
];

View File

@ -0,0 +1,34 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];

View File

@ -0,0 +1,151 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'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 in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| 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 APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'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'),
],
'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'),
],
],
];

View File

@ -0,0 +1,76 @@
<?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. Just store away!
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been set up for each driver as an example of the required values.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => 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,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

View File

@ -0,0 +1,52 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 65536,
'threads' => 1,
'time' => 4,
],
];

View File

@ -0,0 +1,122 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'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' => false,
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
],
'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'),
],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

View File

@ -0,0 +1,124 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| 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 to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array", "failover"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
// 'client' => [
// 'timeout' => 5,
// ],
],
'postmark' => [
'transport' => 'postmark',
// 'client' => [
// 'timeout' => 5,
// ],
],
'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',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails 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 e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];

View File

@ -0,0 +1,93 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'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' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];

View File

@ -0,0 +1,67 @@
<?php
use Laravel\Sanctum\Sanctum;
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort()
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. If this value is null, personal access tokens do
| not expire. This won't tweak the lifetime of first-party sessions.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
],
];

View File

@ -0,0 +1,34 @@
<?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.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
'scheme' => 'https',
],
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];

View File

@ -0,0 +1,201 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| 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 immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'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 we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "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 cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(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 are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'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. You are free to modify this option if needed.
|
*/
'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" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];

View File

@ -0,0 +1,36 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];

1
backend-baru/database/.gitignore vendored Normal file
View File

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

View File

@ -0,0 +1,28 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use App\Models\Guest;
class GuestFactory extends Factory
{
public function definition(): array
{
return [
'id_pelanggan' => null, // Diisi oleh seeder
'nama_tamu' => $this->faker->name(),
'kode_invitasi' => $this->generateUniqueInvitationCode(),
];
}
protected function generateUniqueInvitationCode(): string
{
do {
$code = 'INV-' . strtoupper(Str::random(6));
} while (Guest::where('kode_invitasi', $code)->exists());
return $code;
}
}

View File

@ -0,0 +1,116 @@
<?php
namespace Database\Factories;
use App\Models\Pelanggan;
use App\Models\Template;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Pelanggan>
*/
class PelangganFactory extends Factory
{
protected $model = Pelanggan::class;
public function definition(): array
{
// Get a random template
$template = Template::inRandomOrder()->first() ?? Template::factory()->create();
// Generate form data based on template's form fields
$formData = $this->generateFormData($template->form['fields'] ?? []);
// Generate unique invitation code
$invitationCode = 'INV-' . strtoupper(Str::random(6));
while (Pelanggan::where('kode_pelanggan', $invitationCode)->exists()) {
$invitationCode = 'INV-' . strtoupper(Str::random(6));
}
return [
'nama_pemesan' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'no_tlpn' => $this->faker->phoneNumber(),
'template_id' => $template->id,
'form' => $formData,
'harga' => $template->harga,
'status' => $this->faker->randomElement(['menunggu', 'diterima', 'ditolak']),
'kode_pelanggan' => $invitationCode,
];
}
/**
* Generate form data based on template fields
*
* @param array $fields
* @return array
*/
private function generateFormData(array $fields): array
{
$formData = [];
foreach ($fields as $field) {
$name = $field['name'];
$type = $field['type'] ?? 'text';
switch ($type) {
case 'text':
$formData[$name] = $this->generateTextField($name);
break;
case 'email':
$formData[$name] = $this->faker->safeEmail();
break;
case 'date':
$formData[$name] = $this->faker->date('Y-m-d', 'now +1 month');
break;
case 'number':
$formData[$name] = $this->faker->numberBetween(1, 100);
break;
case 'textarea':
$formData[$name] = $this->faker->paragraph();
break;
case 'file':
$formData[$name] = 'files/' . $this->faker->uuid() . '.jpg';
break;
default:
$formData[$name] = $this->faker->word();
}
}
return $formData;
}
/**
* Generate text field data based on field name
*
* @param string $name
* @return string
*/
private function generateTextField(string $name): string
{
if (str_contains($name, 'nama_')) {
return $this->faker->name();
}
if (str_contains($name, 'alamat')) {
return $this->faker->address();
}
if (str_contains($name, 'link_gmaps')) {
return 'https://maps.google.com/?q=' . $this->faker->latitude() . ',' . $this->faker->longitude();
}
if (str_contains($name, 'instagram') || str_contains($name, 'facebook') || str_contains($name, 'twitter')) {
return 'https://' . str_replace('_', '.', $name) . '/' . $this->faker->userName();
}
if (str_contains($name, 'waktu')) {
return $this->faker->time('H:i');
}
if (str_contains($name, 'rekening')) {
return $this->faker->bankAccountNumber();
}
if (str_contains($name, 'link_music')) {
return 'https://music.example.com/' . $this->faker->uuid();
}
return $this->faker->word();
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* 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' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*
* @return $this
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,32 @@
<?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();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};

View File

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

View File

@ -0,0 +1,32 @@
<?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('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('failed_jobs');
}
};

View File

@ -0,0 +1,33 @@
<?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('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

@ -0,0 +1,21 @@
<?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('kategoris', function (Blueprint $table) {
$table->id();
$table->string('nama');
$table->text('deskripsi')->nullable();
$table->string('foto')->nullable();
$table->timestamps();
});
}
public function down(): void {
Schema::dropIfExists('kategoris');
}
};

View File

@ -0,0 +1,25 @@
<?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('templates', function (Blueprint $table) {
$table->id();
$table->string('nama_template')->unique();
$table->string('slug')->unique();
$table->decimal('harga', 10, 2)->default(0);
$table->string('foto')->nullable();
$table->enum('paket', ['starter', 'basic', 'premium'])->default('starter');
$table->json('form')->nullable();
$table->foreignId('kategori_id')->constrained('kategoris')->cascadeOnDelete();
$table->timestamps();
});
}
public function down(): void {
Schema::dropIfExists('templates');
}
};

View File

@ -0,0 +1,24 @@
<?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('reviews', function (Blueprint $table) {
$table->id();
$table->tinyInteger('rating'); // nilai bintang 15
$table->text('message');
$table->string('name');
$table->string('city');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('reviews');
}
};

View File

@ -0,0 +1,33 @@
<?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('pelanggans', function (Blueprint $table) {
$table->id();
$table->string('nama_pemesan');
$table->string('email');
$table->string('no_tlpn');
// relasi ke template (yang punya struktur form)
$table->foreignId('template_id')->constrained('templates')->cascadeOnDelete();
// hasil isi form pelanggan, disimpan sebagai JSON
$table->json('form')->nullable();
$table->decimal('harga', 15, 2)->nullable();
$table->enum('status', ['menunggu', 'diterima', 'ditolak'])->default('menunggu');
$table->string('kode_pelanggan')->unique();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('pelanggans');
}
};

View File

@ -0,0 +1,24 @@
<?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('admins', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('admins');
}
};

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('guests', function (Blueprint $table) {
$table->id();
$table->foreignId('id_pelanggan')->constrained('pelanggans')->cascadeOnDelete();
$table->string('nama_tamu');
$table->string('kode_invitasi');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('guests');
}
};

View File

@ -0,0 +1,24 @@
<?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('rsvps', function (Blueprint $table) {
$table->id();
$table->foreignId('guest_id')->constrained('guests')->cascadeOnDelete(); // Link ke guests table
$table->string('nama');
$table->text('pesan');
$table->enum('status_kehadiran', ['hadir', 'tidak_hadir', 'mungkin'])->default('mungkin');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('rsvps');
}
};

View File

@ -0,0 +1,21 @@
<?php
namespace Database\Seeders;
use App\Models\Admin;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class AdminSeeder extends Seeder
{
public function run(): void
{
Admin::updateOrCreate(
['email' => 'admin@example.com'],
[
'name' => 'Super Admin',
'password' => Hash::make('password123'),
]
);
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
public function run(): void
{
$this->call([
TemplateSeeder::class,
AdminSeeder::class,
PelangganSeeder::class,
]);
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Pelanggan;
use Illuminate\Support\Str;
class PelangganSeeder extends Seeder
{
public function run(): void
{
$pelanggan = Pelanggan::factory(100)->create();
$guests = [];
foreach ($pelanggan as $item) {
$guestData = \App\Models\Guest::factory()->count(rand(1, 5))->make([
'id_pelanggan' => $item->id,
])->toArray();
$guests = array_merge($guests, $guestData);
}
\App\Models\Guest::insert($guests);
// $pelanggans = [
// [
// 'nama_pemesan' => 'Arief Dwi Wicaksono',
// 'email' => 'arief@example.com',
// 'no_tlpn' => '081234567890',
// 'template_id' => 1, // pastikan ada template_id valid
// 'form' => json_encode([
// 'nama_pria' => 'Arief',
// 'nama_wanita' => 'Nisa',
// 'alamat' => 'Malang',
// ]),
// 'harga' => 150000,
// 'status' => 'menunggu',
// ],
// [
// 'nama_pemesan' => 'Rizky Ramadhan',
// 'email' => 'rizky@example.com',
// 'no_tlpn' => '081298765432',
// 'template_id' => 2,
// 'form' => json_encode([
// 'nama_pria' => 'Rizky',
// 'nama_wanita' => 'Dinda',
// 'alamat' => 'Surabaya',
// ]),
// 'harga' => 250000,
// 'status' => 'diterima',
// ],
// [
// 'nama_pemesan' => 'Siti Rahmawati',
// 'email' => 'siti@example.com',
// 'no_tlpn' => '081212341234',
// 'template_id' => 3,
// 'form' => json_encode([
// 'nama_pria' => 'Andi',
// 'nama_wanita' => 'Siti',
// 'alamat' => 'Jakarta',
// ]),
// 'harga' => 300000,
// 'status' => 'menunggu',
// ],
// ];
// foreach ($pelanggans as $data) {
// $data['invitation_code'] = 'INV-' . strtoupper(Str::random(6)); // 🟢 generate code unik
// Pelanggan::create($data);
// }
}
}

View File

@ -0,0 +1,342 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Kategori;
use App\Models\Template;
class TemplateSeeder extends Seeder
{
public function run(): void
{
$k1 = Kategori::firstOrCreate(['nama' => 'pernikahan']);
$k2 = Kategori::firstOrCreate(['nama' => 'ulang_tahun']);
$k3 = Kategori::firstOrCreate(['nama' => 'khitan']);
Template::create([
'nama_template' => 'Undangan Pernikahan Starter',
'slug' => 'undangan-pernikahan-starter',
'harga' => 100000,
'paket' => 'starter',
'form' => [
'fields' => [
['name' => 'nama_pemesan', 'label' => 'Nama Pemesan', 'type' => 'text', 'required' => true],
['name' => 'email', 'label' => 'Email', 'type' => 'email', 'required' => true],
['name' => 'no_telepon', 'label' => 'No Telepon', 'type' => 'text'],
['name' => 'nama_lengkap_pria', 'label' => 'Nama Lengkap Pria', 'type' => 'text'],
['name' => 'nama_bapak_pria', 'label' => 'Nama Bapak Pria', 'type' => 'text'],
['name' => 'nama_ibu_pria', 'label' => 'Nama Ibu Pria', 'type' => 'text'],
['name' => 'nama_lengkap_wanita', 'label' => 'Nama Lengkap Wanita', 'type' => 'text'],
['name' => 'nama_bapak_wanita', 'label' => 'Nama Bapak Wanita', 'type' => 'text'],
['name' => 'nama_ibu_wanita', 'label' => 'Nama Ibu Wanita', 'type' => 'text'],
['name' => 'hari_tanggal_acara', 'label' => 'Hari & Tanggal Acara', 'type' => 'date'],
['name' => 'waktu', 'label' => 'Waktu', 'type' => 'text'],
['name' => 'alamat', 'label' => 'Alamat', 'type' => 'textarea'],
['name' => 'foto_1', 'label' => 'Foto 1', 'type' => 'file'],
['name' => 'foto_2', 'label' => 'Foto 2', 'type' => 'file'],
]
],
'kategori_id' => $k1?->id,
'foto' => 'templates/Pernikahan.jpg',
]);
Template::create([
'nama_template' => 'Undangan Pernikahan Basic',
'slug' => 'undangan-pernikahan-basic',
'harga' => 175000,
'paket' => 'basic',
'form' => [
'fields' => [
['name' => 'nama_pemesan', 'label' => 'Nama Pemesan', 'type' => 'text', 'required' => true],
['name' => 'email', 'label' => 'Email', 'type' => 'email', 'required' => true],
['name' => 'no_telepon', 'label' => 'No Telepon', 'type' => 'text'],
['name' => 'nama_lengkap_pria', 'label' => 'Nama Lengkap Pria', 'type' => 'text'],
['name' => 'nama_bapak_pria', 'label' => 'Nama Bapak Pria', 'type' => 'text'],
['name' => 'nama_ibu_pria', 'label' => 'Nama Ibu Pria', 'type' => 'text'],
['name' => 'nama_lengkap_wanita', 'label' => 'Nama Lengkap Wanita', 'type' => 'text'],
['name' => 'nama_bapak_wanita', 'label' => 'Nama Bapak Wanita', 'type' => 'text'],
['name' => 'nama_ibu_wanita', 'label' => 'Nama Ibu Wanita', 'type' => 'text'],
['name' => 'hari_tanggal_akad', 'label' => 'Hari & Tanggal Acara (Akad)', 'type' => 'date'],
['name' => 'waktu_akad', 'label' => 'Waktu Akad', 'type' => 'text'],
['name' => 'alamat_akad', 'label' => 'Alamat Akad', 'type' => 'textarea'],
['name' => 'link_gmaps_akad', 'label' => 'Link Gmaps Akad', 'type' => 'text'],
['name' => 'hari_tanggal_resepsi', 'label' => 'Hari & Tanggal Acara (Resepsi)', 'type' => 'date'],
['name' => 'waktu_resepsi', 'label' => 'Waktu Resepsi', 'type' => 'text'],
['name' => 'alamat_resepsi', 'label' => 'Alamat Resepsi', 'type' => 'textarea'],
['name' => 'link_gmaps_resepsi', 'label' => 'Link Gmaps Resepsi', 'type' => 'text'],
['name' => 'say_something', 'label' => 'Say Something', 'type' => 'textarea'],
['name' => 'hitung_mundur', 'label' => 'Hitung Mundur Waktu Acara', 'type' => 'datetime-local'],
['name' => 'rekening_1', 'label' => 'Rekening 1', 'type' => 'text'],
['name' => 'foto_1', 'label' => 'Foto 1', 'type' => 'file'],
['name' => 'foto_2', 'label' => 'Foto 2', 'type' => 'file'],
['name' => 'foto_3', 'label' => 'Foto 3', 'type' => 'file'],
['name' => 'foto_4', 'label' => 'Foto 4', 'type' => 'file'],
['name' => 'link_music', 'label' => 'Link Music', 'type' => 'text'],
]
],
'kategori_id' => $k1?->id,
'foto' => 'templates/Pernikahan.jpg',
]);
Template::create([
'nama_template' => 'Undangan Pernikahan Premium',
'slug' => 'undangan-pernikahan-premium',
'harga' => 350000,
'paket' => 'premium',
'form' => [
'fields' => [
['name' => 'nama_pemesan', 'label' => 'Nama Pemesan', 'type' => 'text', 'required' => true],
['name' => 'email', 'label' => 'Email', 'type' => 'email', 'required' => true],
['name' => 'no_telepon', 'label' => 'No Telepon', 'type' => 'text'],
['name' => 'nama_lengkap_pria', 'label' => 'Nama Lengkap Pria', 'type' => 'text'],
['name' => 'nama_panggilan_pria', 'label' => 'Nama Panggilan Pria', 'type' => 'text'],
['name' => 'nama_bapak_pria', 'label' => 'Nama Bapak Pria', 'type' => 'text'],
['name' => 'nama_ibu_pria', 'label' => 'Nama Ibu Pria', 'type' => 'text'],
['name' => 'link_instagram_pria', 'label' => 'Link Instagram Pria', 'type' => 'text'],
['name' => 'link_facebook_pria', 'label' => 'Link Facebook Pria', 'type' => 'text'],
['name' => 'link_twitter_pria', 'label' => 'Link Twitter Pria', 'type' => 'text'],
['name' => 'nama_lengkap_wanita', 'label' => 'Nama Lengkap Wanita', 'type' => 'text'],
['name' => 'nama_panggilan_wanita', 'label' => 'Nama Panggilan Wanita', 'type' => 'text'],
['name' => 'nama_bapak_wanita', 'label' => 'Nama Bapak Wanita', 'type' => 'text'],
['name' => 'nama_ibu_wanita', 'label' => 'Nama Ibu Wanita', 'type' => 'text'],
['name' => 'link_instagram_wanita', 'label' => 'Link Instagram Wanita', 'type' => 'text'],
['name' => 'link_facebook_wanita', 'label' => 'Link Facebook Wanita', 'type' => 'text'],
['name' => 'link_twitter_wanita', 'label' => 'Link Twitter Wanita', 'type' => 'text'],
['name' => 'cerita_kita', 'label' => 'Cerita Kita', 'type' => 'textarea'],
['name' => 'hari_tanggal_akad', 'label' => 'Hari & Tanggal Acara (Akad)', 'type' => 'date'],
['name' => 'waktu_akad', 'label' => 'Waktu Akad', 'type' => 'text'],
['name' => 'alamat_akad', 'label' => 'Alamat Akad', 'type' => 'textarea'],
['name' => 'link_gmaps_akad', 'label' => 'Link Gmaps Akad', 'type' => 'text'],
['name' => 'hari_tanggal_resepsi', 'label' => 'Hari & Tanggal Acara (Resepsi)', 'type' => 'date'],
['name' => 'waktu_resepsi', 'label' => 'Waktu Resepsi', 'type' => 'text'],
['name' => 'alamat_resepsi', 'label' => 'Alamat Resepsi', 'type' => 'textarea'],
['name' => 'link_gmaps_resepsi', 'label' => 'Link Gmaps Resepsi', 'type' => 'text'],
['name' => 'hari_tanggal_syukuran', 'label' => 'Hari & Tanggal Acara (Syukuran)', 'type' => 'date'],
['name' => 'waktu_syukuran', 'label' => 'Waktu Syukuran', 'type' => 'text'],
['name' => 'alamat_syukuran', 'label' => 'Alamat Syukuran', 'type' => 'textarea'],
['name' => 'link_gmaps_syukuran', 'label' => 'Link Gmaps Syukuran', 'type' => 'text'],
['name' => 'hitung_mundur', 'label' => 'Hitung Mundur Waktu Acara', 'type' => 'datetime-local'],
['name' => 'link_live_streaming', 'label' => 'Link Live Streaming', 'type' => 'text'],
['name' => 'say_something', 'label' => 'Say Something', 'type' => 'textarea'],
['name' => 'rekening_1', 'label' => 'Rekening 1', 'type' => 'text'],
['name' => 'rekening_2', 'label' => 'Rekening 2', 'type' => 'text'],
['name' => 'rekening_3', 'label' => 'Rekening 3', 'type' => 'text'],
['name' => 'foto_1', 'label' => 'Foto 1', 'type' => 'file'],
['name' => 'foto_2', 'label' => 'Foto 2', 'type' => 'file'],
['name' => 'foto_3', 'label' => 'Foto 3', 'type' => 'file'],
['name' => 'foto_4', 'label' => 'Foto 4', 'type' => 'file'],
['name' => 'foto_5', 'label' => 'Foto 5', 'type' => 'file'],
['name' => 'foto_6', 'label' => 'Foto 6', 'type' => 'file'],
['name' => 'foto_7', 'label' => 'Foto 7', 'type' => 'file'],
['name' => 'foto_8', 'label' => 'Foto 8', 'type' => 'file'],
['name' => 'link_music', 'label' => 'Link Music', 'type' => 'text'],
]
],
'kategori_id' => $k1?->id,
'foto' => 'templates/Pernikahan.jpg',
]);
Template::create([
'nama_template' => 'Undangan Ulang Tahun Starter',
'slug' => 'undangan-ulang-tahun-starter',
'harga' => 100000,
'paket' => 'starter',
'form' => [
'fields' => [
['name' => 'nama_pemesan', 'label' => 'Nama Pemesan', 'type' => 'text', 'required' => true],
['name' => 'email', 'label' => 'Email', 'type' => 'email', 'required' => true],
['name' => 'no_telepon', 'label' => 'No Telepon', 'type' => 'text'],
['name' => 'nama_lengkap', 'label' => 'Nama Lengkap', 'type' => 'text'],
['name' => 'umur_yang_dirayakan', 'label' => 'Umur Yang Dirayakan', 'type' => 'number'],
['name' => 'hari_tanggal_acara', 'label' => 'Hari & Tanggal Acara', 'type' => 'date'],
['name' => 'waktu', 'label' => 'Waktu', 'type' => 'text'],
['name' => 'alamat', 'label' => 'Alamat', 'type' => 'textarea'],
['name' => 'foto_1', 'label' => 'Foto 1', 'type' => 'file'],
['name' => 'foto_2', 'label' => 'Foto 2', 'type' => 'file'],
]
],
'kategori_id' => $k2?->id,
'foto' => 'templates/HBD.jpg',
]);
Template::create([
'nama_template' => 'Undangan Ulang Tahun Basic',
'slug' => 'undangan-ulang-tahun-basic',
'harga' => 175000,
'paket' => 'basic',
'form' => [
'fields' => [
['name' => 'nama_pemesan', 'label' => 'Nama Pemesan', 'type' => 'text', 'required' => true],
['name' => 'email', 'label' => 'Email', 'type' => 'email', 'required' => true],
['name' => 'no_telepon', 'label' => 'No Telepon', 'type' => 'text'],
['name' => 'nama_lengkap', 'label' => 'Nama Lengkap', 'type' => 'text'],
['name' => 'nama_panggilan', 'label' => 'Nama Panggilan', 'type' => 'text'],
['name' => 'nama_bapak', 'label' => 'Nama Bapak', 'type' => 'text'],
['name' => 'nama_ibu', 'label' => 'Nama Ibu', 'type' => 'text'],
['name' => 'umur_yang_dirayakan', 'label' => 'Umur Yang Dirayakan', 'type' => 'number'],
['name' => 'hari_tanggal_acara', 'label' => 'Hari & Tanggal Acara', 'type' => 'date'],
['name' => 'waktu', 'label' => 'Waktu', 'type' => 'text'],
['name' => 'alamat', 'label' => 'Alamat', 'type' => 'textarea'],
['name' => 'link_gmaps', 'label' => 'Link Gmaps', 'type' => 'text'],
['name' => 'say_something', 'label' => 'Say Something', 'type' => 'textarea'],
['name' => 'hitung_mundur', 'label' => 'Hitung Mundur Waktu Acara', 'type' => 'datetime-local'],
['name' => 'rekening_1', 'label' => 'Rekening 1', 'type' => 'text'],
['name' => 'foto_1', 'label' => 'Foto 1', 'type' => 'file'],
['name' => 'foto_2', 'label' => 'Foto 2', 'type' => 'file'],
['name' => 'foto_3', 'label' => 'Foto 3', 'type' => 'file'],
['name' => 'foto_4', 'label' => 'Foto 4', 'type' => 'file'],
['name' => 'link_music', 'label' => 'Link Music', 'type' => 'text'],
]
],
'kategori_id' => $k2?->id,
'foto' => 'templates/HBD.jpg',
]);
Template::create([
'nama_template' => 'Undangan Ulang Tahun Premium',
'slug' => 'undangan-ulang-tahun-premium',
'harga' => 250000,
'paket' => 'premium',
'form' => [
'fields' => [
['name' => 'nama_pemesan', 'label' => 'Nama Pemesan', 'type' => 'text', 'required' => true],
['name' => 'email', 'label' => 'Email', 'type' => 'email', 'required' => true],
['name' => 'no_telepon', 'label' => 'No Telepon', 'type' => 'text'],
['name' => 'nama_lengkap', 'label' => 'Nama Lengkap', 'type' => 'text'],
['name' => 'nama_panggilan', 'label' => 'Nama Panggilan', 'type' => 'text'],
['name' => 'nama_bapak', 'label' => 'Nama Bapak', 'type' => 'text'],
['name' => 'nama_ibu', 'label' => 'Nama Ibu', 'type' => 'text'],
['name' => 'umur_yang_dirayakan', 'label' => 'Umur Yang Dirayakan', 'type' => 'number'],
['name' => 'anak_ke', 'label' => 'Anak Ke', 'type' => 'number'],
['name' => 'instagram', 'label' => 'Link Instagram', 'type' => 'text'],
['name' => 'facebook', 'label' => 'Link Facebook', 'type' => 'text'],
['name' => 'twitter', 'label' => 'Link Twitter', 'type' => 'text'],
['name' => 'hari_tanggal_acara', 'label' => 'Hari & Tanggal Acara', 'type' => 'date'],
['name' => 'waktu', 'label' => 'Waktu', 'type' => 'text'],
['name' => 'alamat', 'label' => 'Alamat', 'type' => 'textarea'],
['name' => 'link_gmaps', 'label' => 'Link Gmaps', 'type' => 'text'],
['name' => 'hitung_mundur', 'label' => 'Hitung Mundur Waktu Acara', 'type' => 'datetime-local'],
['name' => 'link_live_streaming', 'label' => 'Link Live Streaming', 'type' => 'text'],
['name' => 'say_something', 'label' => 'Say Something', 'type' => 'textarea'],
['name' => 'rekening_1', 'label' => 'Rekening 1', 'type' => 'text'],
['name' => 'rekening_2', 'label' => 'Rekening 2', 'type' => 'text'],
['name' => 'rekening_3', 'label' => 'Rekening 3', 'type' => 'text'],
['name' => 'foto_1', 'label' => 'Foto 1', 'type' => 'file'],
['name' => 'foto_2', 'label' => 'Foto 2', 'type' => 'file'],
['name' => 'foto_3', 'label' => 'Foto 3', 'type' => 'file'],
['name' => 'foto_4', 'label' => 'Foto 4', 'type' => 'file'],
['name' => 'foto_5', 'label' => 'Foto 5', 'type' => 'file'],
['name' => 'foto_6', 'label' => 'Foto 6', 'type' => 'file'],
['name' => 'foto_7', 'label' => 'Foto 7', 'type' => 'file'],
['name' => 'foto_8', 'label' => 'Foto 8', 'type' => 'file'],
['name' => 'link_music', 'label' => 'Link Music', 'type' => 'text'],
]
],
'kategori_id' => $k2?->id,
'foto' => 'templates/HBD.jpg',
]);
Template::create([
'nama_template' => 'Undangan Khitan Starter',
'slug' => 'undangan-khitan-starter',
'harga' => 100000,
'paket' => 'starter',
'form' => [
'fields' => [
['name' => 'nama_pemesan', 'label' => 'Nama Pemesan', 'type' => 'text', 'required' => true],
['name' => 'email', 'label' => 'Email', 'type' => 'email', 'required' => true],
['name' => 'no_telepon', 'label' => 'No Telepon', 'type' => 'text'],
['name' => 'nama_lengkap', 'label' => 'Nama Lengkap', 'type' => 'text'],
['name' => 'nama_bapak', 'label' => 'Nama Bapak', 'type' => 'text'],
['name' => 'nama_ibu', 'label' => 'Nama Ibu', 'type' => 'text'],
['name' => 'hari_tanggal_acara', 'label' => 'Hari & Tanggal Acara', 'type' => 'date'],
['name' => 'waktu', 'label' => 'Waktu', 'type' => 'text'],
['name' => 'alamat', 'label' => 'Alamat', 'type' => 'textarea'],
['name' => 'foto_1', 'label' => 'Foto 1', 'type' => 'file'],
['name' => 'foto_2', 'label' => 'Foto 2', 'type' => 'file'],
]
],
'kategori_id' => $k3->id,
'foto' => 'templates/Khitan.jpg',
]);
Template::create([
'nama_template' => 'Undangan Khitan Basic',
'slug' => 'undangan-khitan-basic',
'harga' => 175000,
'paket' => 'basic',
'form' => [
'fields' => [
['name' => 'nama_pemesan', 'label' => 'Nama Pemesan', 'type' => 'text', 'required' => true],
['name' => 'email', 'label' => 'Email', 'type' => 'email', 'required' => true],
['name' => 'no_telepon', 'label' => 'No Telepon', 'type' => 'text'],
['name' => 'nama_lengkap', 'label' => 'Nama Lengkap', 'type' => 'text'],
['name' => 'nama_panggilan', 'label' => 'Nama Panggilan', 'type' => 'text'],
['name' => 'nama_bapak', 'label' => 'Nama Bapak', 'type' => 'text'],
['name' => 'nama_ibu', 'label' => 'Nama Ibu', 'type' => 'text'],
['name' => 'hari_tanggal_acara', 'label' => 'Hari & Tanggal Acara', 'type' => 'date'],
['name' => 'waktu', 'label' => 'Waktu', 'type' => 'text'],
['name' => 'alamat', 'label' => 'Alamat', 'type' => 'textarea'],
['name' => 'link_gmaps', 'label' => 'Link Gmaps', 'type' => 'text'],
['name' => 'say_something', 'label' => 'Say Something', 'type' => 'textarea'],
['name' => 'hitung_mundur', 'label' => 'Hitung Mundur Waktu Acara', 'type' => 'datetime-local'],
['name' => 'rekening_1', 'label' => 'Rekening 1', 'type' => 'text'],
['name' => 'foto_1', 'label' => 'Foto 1', 'type' => 'file'],
['name' => 'foto_2', 'label' => 'Foto 2', 'type' => 'file'],
['name' => 'foto_3', 'label' => 'Foto 3', 'type' => 'file'],
['name' => 'foto_4', 'label' => 'Foto 4', 'type' => 'file'],
['name' => 'link_music', 'label' => 'Link Music', 'type' => 'text'],
]
],
'kategori_id' => $k3->id,
'foto' => 'templates/Khitan.jpg',
]);
Template::create([
'nama_template' => 'Undangan Khitan Premium',
'slug' => 'undangan-khitan-premium',
'harga' => 250000,
'paket' => 'premium',
'form' => [
'fields' => [
['name' => 'nama_pemesan', 'label' => 'Nama Pemesan', 'type' => 'text', 'required' => true],
['name' => 'email', 'label' => 'Email', 'type' => 'email', 'required' => true],
['name' => 'no_telepon', 'label' => 'No Telepon', 'type' => 'text'],
['name' => 'nama_lengkap', 'label' => 'Nama Lengkap', 'type' => 'text'],
['name' => 'nama_panggilan', 'label' => 'Nama Panggilan', 'type' => 'text'],
['name' => 'nama_bapak', 'label' => 'Nama Bapak', 'type' => 'text'],
['name' => 'nama_ibu', 'label' => 'Nama Ibu', 'type' => 'text'],
['name' => 'link_instagram', 'label' => 'Link Instagram', 'type' => 'text'],
['name' => 'link_facebook', 'label' => 'Link Facebook', 'type' => 'text'],
['name' => 'link_twitter', 'label' => 'Link Twitter', 'type' => 'text'],
['name' => 'hari_tanggal_acara', 'label' => 'Hari & Tanggal Acara', 'type' => 'date'],
['name' => 'waktu', 'label' => 'Waktu', 'type' => 'text'],
['name' => 'alamat', 'label' => 'Alamat', 'type' => 'textarea'],
['name' => 'link_gmaps', 'label' => 'Link Gmaps', 'type' => 'text'],
['name' => 'hari_tanggal_syukuran', 'label' => 'Hari & Tanggal Acara (Syukuran)', 'type' => 'date'],
['name' => 'waktu_syukuran', 'label' => 'Waktu Syukuran', 'type' => 'text'],
['name' => 'alamat_syukuran', 'label' => 'Alamat Syukuran', 'type' => 'textarea'],
['name' => 'link_gmaps_syukuran', 'label' => 'Link Gmaps Syukuran', 'type' => 'text'],
['name' => 'hitung_mundur', 'label' => 'Hitung Mundur Waktu Acara', 'type' => 'datetime-local'],
['name' => 'link_live_streaming', 'label' => 'Link Live Streaming', 'type' => 'text'],
['name' => 'say_something', 'label' => 'Say Something', 'type' => 'textarea'],
['name' => 'rekening_1', 'label' => 'Rekening 1', 'type' => 'text'],
['name' => 'rekening_2', 'label' => 'Rekening 2', 'type' => 'text'],
['name' => 'rekening_3', 'label' => 'Rekening 3', 'type' => 'text'],
['name' => 'foto_1', 'label' => 'Foto 1', 'type' => 'file'],
['name' => 'foto_2', 'label' => 'Foto 2', 'type' => 'file'],
['name' => 'foto_3', 'label' => 'Foto 3', 'type' => 'file'],
['name' => 'foto_4', 'label' => 'Foto 4', 'type' => 'file'],
['name' => 'foto_5', 'label' => 'Foto 5', 'type' => 'file'],
['name' => 'foto_6', 'label' => 'Foto 6', 'type' => 'file'],
['name' => 'foto_7', 'label' => 'Foto 7', 'type' => 'file'],
['name' => 'foto_8', 'label' => 'Foto 8', 'type' => 'file'],
['name' => 'link_music', 'label' => 'Link Music', 'type' => 'text'],
]
],
'kategori_id' => $k3->id,
'foto' => 'templates/Khitan.jpg',
]);
}
}

12
backend-baru/package.json Normal file
View File

@ -0,0 +1,12 @@
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.2",
"vite": "^4.0.0"
}
}

31
backend-baru/phpunit.xml Normal file
View File

@ -0,0 +1,31 @@
<?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 suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
<php>
<env name="APP_ENV" value="testing"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_DRIVER" value="array"/>
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>

View File

@ -0,0 +1,21 @@
<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}]
# 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1,55 @@
<?php
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Check If The Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is in maintenance / demo mode via the "down" command
| we will load this file so that any pre-rendered content can be shown
| instead of starting the framework, which could cause an exception.
|
*/
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = $kernel->handle(
$request = Request::capture()
)->send();
$kernel->terminate($request, $response);

View File

@ -0,0 +1,2 @@
User-agent: *
Disallow:

View File

View File

@ -0,0 +1 @@
import './bootstrap';

32
backend-baru/resources/js/bootstrap.js vendored Normal file
View File

@ -0,0 +1,32 @@
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from 'laravel-echo';
// import Pusher from 'pusher-js';
// window.Pusher = Pusher;
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: import.meta.env.VITE_PUSHER_APP_KEY,
// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
// wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
// enabledTransports: ['ws', 'wss'],
// });

View File

@ -0,0 +1,109 @@
<!doctype html>
<html lang="id">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Login Admin</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background: #ffffff;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.login-card {
background: #EFEFEF;
border-radius: 15px;
box-shadow: 0 0 25px rgb(0, 123, 255);
width: 100%;
max-width: 400px; /* batas lebar maksimum */
padding: 30px;
}
.login-logo {
display: block;
margin: 0 auto 15px;
max-width: 130px;
}
.btn-login {
background-color: #3bb9ff;
border: none;
border-radius: 8px;
}
.btn-login:hover {
background-color: #1a8edb;
}
.form-control {
border-radius: 10px;
}
/* Responsive padding */
@media (max-width: 576px) {
.login-card {
padding: 20px;
margin: 10px;
}
.login-logo {
max-width: 100px;
}
h4 {
font-size: 1.2rem;
}
p {
font-size: 0.9rem;
}
}
</style>
</head>
<body>
<div class="login-card">
<div class="text-center mb-3">
<!-- Logo -->
<img src="{{ asset('images/logo.png') }}" alt="Logo" class="login-logo">
</div>
<h4 class="text-center mb-2 fw-bold">SELAMAT DATANG</h4>
<p class="text-center text-muted mb-4">Silakan masukkan email dan password anda.</p>
@if ($errors->any())
<div class="alert alert-danger">
{{ $errors->first() }}
</div>
@endif
<form action="{{ route('admin.login.post') }}" method="POST">
@csrf
<div class="mb-3">
<label class="form-label">Nama</label>
<input type="email" name="email" value="{{ old('email') }}" class="form-control"
placeholder="Masukkan nama Anda" required autofocus>
</div>
<div class="mb-3">
<label class="form-label">Kata Sandi</label>
<input type="password" name="password" class="form-control"
placeholder="Masukkan kata sandi Anda" required>
</div>
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="remember" id="remember">
<label class="form-check-label" for="remember">Ingat saya</label>
</div>
<a href="#" class="text-decoration-none mt-2 mt-sm-0">Lupa kata sandi</a>
</div>
<button type="submit" class="btn btn-login text-white w-100">Login</button>
</form>
</div>
</body>
</html>

View File

@ -0,0 +1,112 @@
@extends('layouts.app')
@section('title', 'Halaman Dasbor')
@section('content')
<div class="container mx-auto py-4">
<!-- Header -->
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold">Halaman Dasbor</h3>
<div class="flex items-center gap-3">
<div class="bg-blue-100 text-blue-600 px-3 py-2 rounded-lg flex items-center gap-2 text-sm">
<i class="bi bi-clock-history"></i>
{{ \Carbon\Carbon::now()->translatedFormat('d M Y') }}
</div>
</div>
</div>
<!-- Cards -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
<div
class="bg-white rounded-lg shadow-md p-4 flex justify-between items-center hover:shadow-lg transition-transform duration-300 transform hover:-translate-y-2">
<div>
<h5 class="text-gray-500 text-sm">Kategori</h5>
<h3 class="font-bold text-xl">{{ $totalKategori }}</h3>
</div>
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center text-xl">
<i class="bi bi-diagram-3"></i>
</div>
</div>
<div
class="bg-white rounded-lg shadow-md p-4 flex justify-between items-center hover:shadow-lg transition-transform duration-300 transform hover:-translate-y-2">
<div>
<h5 class="text-gray-500 text-sm">Template</h5>
<h3 class="font-bold text-xl">{{ $totalTemplate }}</h3>
</div>
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center text-xl">
<i class="bi bi-card-list"></i>
</div>
</div>
<div
class="bg-white rounded-lg shadow-md p-4 flex justify-between items-center hover:shadow-lg transition-transform duration-300 transform hover:-translate-y-2">
<div>
<h5 class="text-gray-500 text-sm">Pelanggan</h5>
<h3 class="font-bold text-xl">{{ $totalPelanggan }}</h3>
</div>
<div class="w-12 h-12 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center text-xl">
<i class="bi bi-person"></i>
</div>
</div>
</div>
<!-- Recent Pelanggan -->
<div class="bg-white rounded-lg shadow mt-6 overflow-x-auto">
<div class="p-4">
<h4 class="text-lg font-bold mb-3">Pelanggan Terbaru</h4>
<table class="w-full border border-gray-200 text-left border-collapse">
<thead class="bg-gray-100">
<tr>
<th class="px-3 py-2 border border-gray-200 w-[50px] text-center">No.</th>
<th class="px-3 py-2 border border-gray-200 text-center">Nama</th>
<th class="px-3 py-2 border border-gray-200 text-center">Template</th>
<th class="px-3 py-2 border border-gray-200 text-center">Kategori</th>
<th class="px-3 py-2 border border-gray-200 text-center">Email</th>
<th class="px-3 py-2 border border-gray-200 text-center">No. Telepon</th>
<th class="px-3 py-2 border border-gray-200 text-center">Harga</th>
<th class="px-3 py-2 border border-gray-200 text-center">Tanggal Pemesanan</th>
</tr>
</thead>
<tbody>
@forelse ($pelangganTerbaru as $index => $p)
<tr class="hover:bg-gray-50">
<td class="px-3 py-2 border border-gray-200 text-center">{{ $index + 1 }}</td>
<td class="px-3 py-2 border border-gray-200 text-center">{{ $p->nama_pemesan }}</td>
<td class="px-3 py-2 border border-gray-200 text-center">
{{ $p->template->nama_template ?? '-' }}
</td>
<td class="px-3 py-2 border border-gray-200 text-center">
{{ $p->template->kategori->nama ?? '-' }}
</td>
<td class="px-3 py-2 border border-gray-200 text-center">{{ $p->email }}</td>
<td class="px-3 py-2 border border-gray-200 text-center">{{ $p->no_tlpn }}</td>
<td class="px-3 py-2 border border-gray-200 text-center">
Rp {{ number_format($p->harga, 0, ',', '.') }}
</td>
<td class="px-3 py-2 border border-gray-200 text-center">
{{ $p->created_at->translatedFormat('d M Y') }}
</td>
</tr>
@empty
<tr>
<td colspan="8" class="px-3 py-4 text-center text-gray-500 border border-gray-200">
Belum ada data pelanggan.
</td>
</tr>
@endforelse
</tbody>
</table>
<!-- Pagination Placeholder -->
<div class="p-4 flex justify-center">
<div class="flex space-x-1">
<span class="px-3 py-1 rounded-lg bg-gray-200 text-gray-500 cursor-not-allowed">Prev</span>
<span class="px-3 py-1 rounded-lg bg-blue-600 text-white font-semibold">1</span>
<span class="px-3 py-1 rounded-lg bg-gray-200 text-gray-500 cursor-not-allowed">Next</span>
</div>
</div>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,60 @@
@extends('layouts.app')
@section('title', 'Tambah Kategori')
@section('content')
<div class="container mx-auto py-8">
<div class="max-w-2xl mx-auto bg-white shadow-md rounded-xl p-8 border border-blue-100">
<h2 class="text-2xl font-semibold text-black mb-6">Tambah Kategori</h2>
<form action="{{ route('admin.kategori.store') }}" method="POST" enctype="multipart/form-data" class="space-y-5">
@csrf
<!-- Nama Kategori -->
<div>
<label for="nama" class="block text-sm font-medium text-gray-700 mb-2">Nama Kategori</label>
<input type="text" id="nama" name="nama"
value="{{ old('nama') }}"
class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-blue-400 focus:outline-none @error('nama') border-red-500 @enderror"
placeholder="Masukkan nama kategori" required>
@error('nama')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Deskripsi -->
<div>
<label for="deskripsi" class="block text-sm font-medium text-gray-700 mb-2">Deskripsi</label>
<textarea id="deskripsi" name="deskripsi" rows="4"
class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-blue-400 focus:outline-none @error('deskripsi') border-red-500 @enderror"
placeholder="Tuliskan deskripsi kategori">{{ old('deskripsi') }}</textarea>
@error('deskripsi')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Foto -->
<div>
<label for="foto" class="block text-sm font-medium text-gray-700 mb-2">Foto</label>
<input type="file" id="foto" name="foto"
class="w-full border border-gray-300 rounded-lg px-4 py-2 bg-gray-50 cursor-pointer focus:ring-2 focus:ring-blue-400 @error('foto') border-red-500 @enderror">
@error('foto')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Tombol -->
<div class="flex justify-end gap-3 pt-4">
<a href="{{ route('admin.kategori.index') }}"
class="bg-gray-100 hover:bg-gray-200 text-gray-700 font-medium px-5 py-2 rounded-lg transition duration-200">
Kembali
</a>
<button type="submit"
class="bg-blue-600 hover:bg-blue-700 text-white font-medium px-6 py-2 rounded-lg shadow transition duration-200">
Simpan
</button>
</div>
</form>
</div>
</div>
@endsection

View File

@ -0,0 +1,66 @@
@extends('layouts.app')
@section('title', 'Edit Kategori')
@section('content')
<div class="container mx-auto py-8">
<div class="max-w-2xl mx-auto bg-white shadow-md rounded-xl p-8 border border-blue-100">
<h2 class="text-2xl font-semibold text-black mb-6">Edit Kategori</h2>
<form action="{{ route('admin.kategori.update', $kategori->id) }}" method="POST" enctype="multipart/form-data" class="space-y-5">
@csrf
@method('PUT')
<!-- Nama Kategori -->
<div>
<label for="nama" class="block text-sm font-medium text-gray-700 mb-2">Nama Kategori</label>
<input type="text" id="nama" name="nama"
value="{{ old('nama', $kategori->nama) }}"
class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-blue-400 focus:outline-none @error('nama') border-red-500 @enderror"
placeholder="Masukkan nama kategori" required>
@error('nama')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Deskripsi -->
<div>
<label for="deskripsi" class="block text-sm font-medium text-gray-700 mb-2">Deskripsi</label>
<textarea id="deskripsi" name="deskripsi" rows="4"
class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-blue-400 focus:outline-none @error('deskripsi') border-red-500 @enderror"
placeholder="Tuliskan deskripsi kategori">{{ old('deskripsi', $kategori->deskripsi) }}</textarea>
@error('deskripsi')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Foto -->
<div>
<label for="foto" class="block text-sm font-medium text-gray-700 mb-2">Foto</label>
@if($kategori->foto)
<div class="mb-3">
<img src="{{ asset('storage/'.$kategori->foto) }}" alt="Foto Kategori" class="w-32 h-32 object-cover rounded-lg border border-gray-200">
</div>
@endif
<input type="file" id="foto" name="foto"
class="w-full border border-gray-300 rounded-lg px-4 py-2 bg-gray-50 cursor-pointer focus:ring-2 focus:ring-blue-400 @error('foto') border-red-500 @enderror">
@error('foto')
<p class="text-red-500 text-sm mt-1">{{ $message }}</p>
@enderror
</div>
<!-- Tombol -->
<div class="flex justify-end gap-3 pt-4">
<a href="{{ route('admin.kategori.index') }}"
class="bg-gray-100 hover:bg-gray-200 text-gray-700 font-medium px-5 py-2 rounded-lg transition duration-200">
Kembali
</a>
<button type="submit"
class="bg-blue-600 hover:bg-blue-700 text-white font-medium px-6 py-2 rounded-lg shadow transition duration-200">
Update
</button>
</div>
</form>
</div>
</div>
@endsection

View File

@ -0,0 +1,81 @@
@extends('layouts.app')
@section('title', 'Manajemen Kategori')
@section('content')
<div class="container mx-auto py-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold">Daftar Kategori</h2>
<a href="{{ route('admin.kategori.create') }}"
class="bg-blue-600 text-white px-4 py-2 rounded-lg shadow hover:bg-blue-700 flex items-center">
<i class="bi bi-plus-lg mr-1"></i> Tambah Kategori
</a>
</div>
<!-- Flash Message -->
@if(session('success'))
<div class="mb-4 p-3 rounded bg-green-100 text-green-800 border border-green-300 shadow">
{{ session('success') }}
</div>
@endif
<!-- Tabel -->
<div class="bg-white rounded-lg shadow overflow-x-auto">
<table class="w-full border border-gray-200 text-left border-collapse">
<thead class="bg-gray-100">
<tr>
<th class="px-3 py-2 border border-gray-200 w-[50px] text-center">No.</th>
<th class="px-3 py-2 border border-gray-200">Nama</th>
<th class="px-3 py-2 border border-gray-200">Deskripsi</th>
<th class="px-3 py-2 border border-gray-200 text-center w-[100px]">Foto</th>
<th class="px-3 py-2 border border-gray-200 text-center w-[150px]">Aksi</th>
</tr>
</thead>
<tbody>
@forelse($kategori as $index => $kat)
<tr class="hover:bg-gray-50">
<td class="px-3 py-2 border border-gray-200 text-center">{{ $index + 1 }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $kat->nama }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $kat->deskripsi ?? '-' }}</td>
<td class="px-3 py-2 border border-gray-200 text-center">
@if($kat->foto)
<div class="w-16 h-16 mx-auto rounded overflow-hidden bg-gray-100 flex items-center justify-center">
<img src="{{ asset('storage/'.$kat->foto) }}"
class="max-w-full max-h-full object-contain">
</div>
@else
<span class="text-gray-400 text-sm">Tidak ada</span>
@endif
</td>
<td class="px-3 py-2 border border-gray-200 text-center">
<div class="flex justify-center gap-2">
<a href="{{ route('admin.kategori.edit', $kat->id) }}"
class="px-3 py-1 rounded bg-yellow-500 text-white text-sm hover:bg-yellow-600 flex items-center">
<i class="bi bi-pencil mr-1"></i> Edit
</a>
<form action="{{ route('admin.kategori.destroy', $kat->id) }}"
method="POST"
onsubmit="return confirm('Yakin ingin menghapus kategori ini?')">
@csrf
@method('DELETE')
<button type="submit"
class="px-3 py-1 rounded bg-red-600 text-white text-sm hover:bg-red-700 flex items-center">
<i class="bi bi-trash mr-1"></i> Hapus
</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="5"
class="px-3 py-4 text-center text-gray-500 border border-gray-200">
Belum ada kategori.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
@endsection

View File

@ -0,0 +1,104 @@
@extends('layouts.app')
@section('title', 'Buat Pesanan')
@section('content')
<div class="container mx-auto py-8">
<div class="max-w-2xl mx-auto bg-white shadow-md rounded-xl p-8 border border-blue-100">
<h2 class="text-2xl font-semibold text-black mb-6">Buat Pesanan</h2>
<form action="{{ route('pelanggans.store') }}" method="POST" class="space-y-5">
@csrf
<!-- Nama Pemesan -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Nama Pemesan</label>
<input type="text" name="nama_pemesan"
value="{{ old('nama_pemesan') }}"
class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-blue-400 focus:outline-none"
required>
</div>
<!-- Email -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Email</label>
<input type="email" name="email"
value="{{ old('email') }}"
class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-blue-400 focus:outline-none"
required>
</div>
<!-- No. Telepon -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">No. Telepon</label>
<input type="text" name="no_tlpn"
value="{{ old('no_tlpn') }}"
class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-blue-400 focus:outline-none"
required>
</div>
<!-- Template -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Template</label>
<select name="template_id" id="template_id"
class="w-full border border-gray-300 rounded-lg px-4 py-2 bg-gray-50 focus:ring-2 focus:ring-blue-400 focus:outline-none"
required>
<option value="">-- Pilih Template --</option>
@foreach($templates as $template)
<option value="{{ $template->id }}" data-form='@json($template->form)'>
{{ $template->nama_template }} (Rp {{ number_format($template->harga,0,',','.') }})
</option>
@endforeach
</select>
</div>
<!-- Tempat field dinamis -->
<div id="dynamic-form"></div>
<!-- Tombol -->
<div class="flex justify-end pt-4">
<button type="submit"
class="bg-blue-600 hover:bg-blue-700 text-white font-medium px-6 py-2 rounded-lg shadow transition duration-200">
Kirim Pesanan
</button>
</div>
</form>
</div>
</div>
<script>
document.getElementById('template_id').addEventListener('change', function () {
let selected = this.options[this.selectedIndex];
let formJson = selected.getAttribute('data-form');
let container = document.getElementById('dynamic-form');
container.innerHTML = '';
if (formJson) {
let fields = JSON.parse(formJson);
for (let key in fields) {
let field = fields[key];
let label = field.label ?? key;
let input = '';
if (field.type === 'text') {
input = `<input type="text" name="form[${key}]" class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-blue-400 focus:outline-none" ${field.required ? 'required' : ''}>`;
} else if (field.type === 'textarea') {
input = `<textarea name="form[${key}]" class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-blue-400 focus:outline-none" ${field.required ? 'required' : ''}></textarea>`;
} else if (field.type === 'select') {
input = `<select name="form[${key}]" class="w-full border border-gray-300 rounded-lg px-4 py-2 bg-gray-50 focus:ring-2 focus:ring-blue-400 focus:outline-none">`;
field.options.forEach(opt => {
input += `<option value="${opt}">${opt}</option>`;
});
input += `</select>`;
}
container.innerHTML += `
<div class="mb-3">
<label class="block text-sm font-medium text-gray-700 mb-2">${label}</label>
${input}
</div>
`;
}
}
});
</script>
@endsection

View File

@ -0,0 +1,112 @@
@extends('layouts.app')
@section('title', 'Daftar Pesanan Pelanggan')
@section('content')
<div class="container mx-auto py-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold">Daftar Pesanan</h2>
</div>
<!-- Flash Message -->
@if(session('success'))
<div class="mb-4 p-3 rounded bg-green-100 text-green-800 border border-green-300 shadow">
{{ session('success') }}
</div>
@endif
<!-- Tabel -->
<div class="bg-white rounded-lg shadow overflow-x-auto">
<table class="w-full border border-gray-200 text-left border-collapse">
<thead class="bg-gray-100">
<tr>
<th class="px-3 py-2 border border-gray-200 w-[50px] text-center">No.</th>
<th class="px-3 py-2 border border-gray-200">Nama Pemesan</th>
<th class="px-3 py-2 border border-gray-200">Email</th>
<th class="px-3 py-2 border border-gray-200">Template</th>
<th class="px-3 py-2 border border-gray-200">Harga</th>
<th class="px-3 py-2 border border-gray-200">Status</th>
<th class="px-3 py-2 border border-gray-200 text-center w-[200px]">Aksi</th>
</tr>
</thead>
<tbody>
@forelse($pelanggans as $index => $pelanggan)
<tr class="hover:bg-gray-50">
<td class="px-3 py-2 border border-gray-200 text-center">{{ $index + 1 }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $pelanggan->nama_pemesan }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $pelanggan->email }}</td>
<td class="px-3 py-2 border border-gray-200">{{ $pelanggan->template->nama_template ?? '-' }}</td>
<!-- Harga -->
<td class="px-3 py-2 border border-gray-200">
Rp {{ number_format($pelanggan->harga, 0, ',', '.') }}
</td>
<!-- Status -->
<td class="px-3 py-2 border border-gray-200">
<span class="px-2 py-1 rounded text-sm
{{ $pelanggan->status == 'diterima' ? 'bg-green-100 text-green-700' :
($pelanggan->status == 'ditolak' ? 'bg-red-100 text-red-700' :
'bg-yellow-100 text-yellow-700') }}">
{{ ucfirst($pelanggan->status) }}
</span>
</td>
<!-- Kolom Aksi -->
<td class="px-3 py-2 border border-gray-200 text-center">
<div class="flex justify-center items-center gap-2">
@if($pelanggan->status == 'menunggu')
<!-- Tombol Terima -->
<form action="{{ route('admin.pelanggan.update', $pelanggan->id) }}" method="POST" onsubmit="return confirm('Terima pesanan ini?')">
@csrf
@method('PUT')
<input type="hidden" name="status" value="diterima">
<button class="inline-flex items-center justify-center gap-1 px-3 py-1.5 rounded-md bg-green-500 text-white text-sm font-medium hover:bg-green-600 transition-all">
<i class="bi bi-check-circle"></i> Terima
</button>
</form>
<!-- Tombol Tolak -->
<form action="{{ route('admin.pelanggan.update', $pelanggan->id) }}" method="POST" onsubmit="return confirm('Tolak pesanan ini?')">
@csrf
@method('PUT')
<input type="hidden" name="status" value="ditolak">
<button class="inline-flex items-center justify-center gap-1 px-3 py-1.5 rounded-md bg-red-500 text-white text-sm font-medium hover:bg-red-600 transition-all">
<i class="bi bi-x-circle"></i> Tolak
</button>
</form>
@else
<!-- Tombol Detail -->
<a href="{{ route('admin.pelanggan.show', $pelanggan->id) }}"
class="inline-flex items-center justify-center gap-1 px-3 py-1.5 rounded-md bg-blue-500 text-white text-sm font-medium hover:bg-blue-600 transition-all">
<i class="bi bi-eye"></i> Detail
</a>
<!-- Tombol Hapus -->
<form action="{{ route('admin.pelanggan.destroy', $pelanggan->id) }}" method="POST" onsubmit="return confirm('Yakin hapus pesanan?')">
@csrf
@method('DELETE')
<button class="inline-flex items-center justify-center gap-1 px-3 py-1.5 rounded-md bg-gray-500 text-white text-sm font-medium hover:bg-gray-600 transition-all">
<i class="bi bi-trash"></i> Hapus
</button>
</form>
@endif
</div>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="px-3 py-4 text-center text-gray-500 border border-gray-200">
Belum ada pesanan.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="mt-4">
{{ $pelanggans->links() }}
</div>
</div>
@endsection

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