Compare commits

..

No commits in common. "frontend-user" and "main" have entirely different histories.

4960 changed files with 1945187 additions and 9398 deletions

View File

@ -1,59 +0,0 @@
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_APP_NAME="${APP_NAME}"
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}"

View File

@ -0,0 +1,127 @@
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use App\Models\User;
class LoginApiController extends Controller
{
/**
* Create a new AuthController instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth:api', ['except' => ['login', 'register', 'hai']]);
}
/**
* Get a JWT via given credentials.
*
* @return \Illuminate\Http\JsonResponse
*/
public function login()
{
// $request->validate([
// 'email' => 'required|string|email',
// 'password' => 'required',
// ]);
$credentials = request(['email', 'password']);
if (!($token = auth()->attempt($credentials))) {
return response()->json(['error' => 'Unauthorized'], 401);
}
return $this->respondWithToken($token);
}
/**
* Get the authenticated User.
*
* @return \Illuminate\Http\JsonResponse
*/
public function me()
{
return response()->json(Auth::user());
}
public function hai()
{
return response()->json([
'message' => 'Hello from API',
]);
}
/**
* Log the user out (Invalidate the token).
*
* @return \Illuminate\Http\JsonResponse
*/
public function logout()
{
auth()->logout();
return response()->json(['message' => 'Successfully logged out']);
}
/**
* Refresh a token.
*
* @return \Illuminate\Http\JsonResponse
*/
public function refresh()
{
return $this->respondWithToken(Auth::refresh());
}
/**
* Get the token array structure.
*
* @param string $token
*
* @return \Illuminate\Http\JsonResponse
*/
protected function respondWithToken($token)
{
return response()->json([
'user' => auth()->user(),
'access_token' => $token,
'token_type' => 'bearer',
'expires_in' => Auth::factory()->getTTL() * 60,
// 'status' => auth()->check(),
]);
}
public function register(Request $request)
{
$request->validate([
'name' => 'required|string|max:255',
'email' => 'required|string|email|unique:users',
'password' => 'required|string|min:8',
]);
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
return response()->json([
'message' => 'User created successfully',
'user' => $user,
]);
}
// public function check()
// {
// return response()->json([
// 'status' => auth()->check(),
// ]);
// }
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Carbon\Carbon;
use App\Models\Transactions;
use App\Models\Transaction;
use App\Models\Refund;
use Illuminate\Support\Facades\Auth;
class AdminDashboardController extends Controller
{
public function index(){
$sumSettlement = 0;
$sumCancelled = 0;
$sumRefund = 0;
$currentYear = Carbon::now()->year;
$dataChartTransaction = [];
$dataChartRefund = [];
for($bulan = 1; $bulan <= 12; $bulan++){
$transaction = Transaction::whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total_bayar');
// $transaction = Transaction::where('status','finished')->whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total_bayar');
// $refund = Refund::whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total');
// $refund = Refund::where('status','Partial Refund')->whereMonth('created_at',$bulan)->whereYear('created_at', $currentYear)->sum('total');
$dataChartTransaction[] = intval($transaction);
// $dataChartRefund[] = intval($refund);
}
return view('admin.index',[
"transaction"=>Transactions::allTransactions(),
"dataChartTransaction" => $dataChartTransaction,
// "dataChartRefund" => $dataChartRefund
]);
}
public function profile(){
return view('admin.profile.index');
}
}

View File

@ -0,0 +1,73 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\Refund;
use App\Models\Refunds;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class AdminRefundController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
// $refundData = Refund::all();
// return view('Admin.refund.history-refund', ['history_refund' => $refundData]);
return view('admin.refund.index',[
"refunds" => Refunds::HistoryRefund()
]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(Refund $refund)
{
return view('admin.refund.detail-refund',[
"detail_refund"=> Refunds::DetailRefund()
]);
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Refund $refund)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Refund $refund)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Refund $refund)
{
//
}
}

View File

@ -0,0 +1,101 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\Setting;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class AdminSettingController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$settings = Setting::all();
return view('admin.setting.index', [
'settings' => $settings,
]);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
// dd($request->persentase);
[$tahun, $bulan] = explode('-', $request->bulan_tahun);
Setting::create([
'bulan' => $bulan,
'tahun' => $tahun,
'persentase' => $request->persentase,
'status' => 'Active',
]);
return redirect()->route('admin-setting.index');
}
/**
* Display the specified resource.
*/
public function show(Setting $setting)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Setting $setting)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
// dd($setting['status'] );
$setting = Setting::findOrFail($id);
if ($setting->status == 'Active') {
$setting->status = 'Nonactive';
$result = $setting->save();
if ($result) {
return response()->json([
'message' => "Berhasil update kebijakan",
'status' => true,
]);
} else {
return response()->json([
'message' => "Gagal update kebijakan",
'status' => true,
]);
}
} else {
$setting->status = 'Active';
$result = $setting->save();
if ($result) {
return response()->json([
'message' => "Berhasil update kebijakan",
'status' => true,
]);
} else {
return response()->json([
'message' => "Gagal update kebijakan",
'status' => true,
]);
}
}
// return response()->json($id);
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Setting $setting)
{
//
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\Transaction;
use App\Models\Transactions;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class AdminTransactionController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('admin.transaction.index', [
'transactions' => Transaction::all(),
]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(transaction $transaction)
{
return view('admin.transaction.detail-transaction',[
'detail_transaction' => Transactions::allDetailTransactions()
]);
}
/**
* Show the form for editing the specified resource.
*/
public function edit(transaction $transaction)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, transaction $transaction)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(transaction $transaction)
{
//
}
}

View File

@ -0,0 +1,127 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class AdminUserController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
// $users = User::where('role', 'User')
// ->orderByRaw("FIELD(status, 'Progress', 'Finished', 'Rejected') ASC")
// ->latest()
// ->get();
$users = User::where('role', 'User')
->orderByRaw("CASE WHEN status = 'Progress' THEN 1 WHEN status = 'Finished' THEN 2 WHEN status = 'Rejected' THEN 3 ELSE 4 END ASC")
->latest()
->get();
return view('admin.users.index', ['users' => $users]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show($id)
{
$user = User::find($id);
return view('admin.users.detail-user', ['user' => $user]);
}
/**
* Show the form for editing the specified resource.
*/
public function edit(User $user)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
return response()->json([
'user' => $request,
'id' => $id,
]);
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$result = User::destroy($id);
if ($result) {
return response()->json([
'message' => 'Berhasil hapus data',
'status' => true,
]);
}
} catch (\Exception $e) {
return response()->json([
'message' => 'Gagal hapus data, karena ' . $e,
'status' => false,
]);
}
}
public function approveUser($id)
{
$user = User::findOrFail($id);
$user->status = 'Finished';
$result = $user->save();
if ($result) {
return response()->json([
'message' => 'Akun telah disetujui dan dapat digunakan',
'status' => true,
]);
} else {
return response()->json([
'message' => 'Akun gagal disetujui karena ' + $result,
'status' => false,
]);
}
}
public function denyUser($id)
{
$user = User::findOrFail($id);
$user->status = 'Rejected';
$result = $user->save();
if ($result) {
return response()->json([
'message' => 'Akun telah ditolak dan tidak dapat digunakan',
'status' => true,
]);
} else {
return response()->json([
'message' => 'Akun gagal ditolak karena ' + $result,
'status' => false,
]);
}
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ApiController extends Controller
{
public function payment_handler(Request $request) {
$json = json_decode($request->getContent());
$signature_key = hash('sha512', $json->order_id . $json->status_code . $json->gross_amount . env('MIDTRANS_SERVER_KEY'));
return $signature_key;
if ($signature_key != $json->signature_key) {
return "This is Invalid Signature";
}
// status confirm
$payment = Order::where('order_id', $json->order_id)->first();
return $payment->update(['status'=>$json->transaction_status]);
}
}

View File

@ -0,0 +1,352 @@
<?php
namespace App\Http\Controllers\Login;
use App\Http\Controllers\Controller;
use App\Mail\verificationMail;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use App\Models\User;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Storage;
use thiagoalessio\TesseractOCR\TesseractOCR;
use Intervention\Image\ImageManagerStatic as Image;
use Illuminate\Support\Facades\Session;
use Laravolt\Indonesia\Models\City;
use Laravolt\Indonesia\Models\District;
use Laravolt\Indonesia\Models\Province;
use Laravolt\Indonesia\Models\Village;
use Ramsey\Uuid\Uuid;
class LoginController extends Controller
{
// /**
// * Create a new AuthController instance.
// *
// * @return void
// */
// public function __construct()
// {
// $this->middleware('auth:api', ['except' => ['login', 'authenticate', 'register', 'hai']]);
// }
public function login()
{
return view('index');
}
/**
* Get a JWT via given credentials.
*
* @return \Illuminate\Http\JsonResponse
*/
public function authenticate(Request $request)
{
// dd($request);
$credentials = $request->validate(
[
'email' => ['required', 'email'],
'password' => ['required', 'min:8'],
],
[
'email.required' => 'Alamat email wajib diisi.',
'email.email' => 'Alamat email harus berformat valid.',
'password.required' => 'Password wajib diisi.',
'password.min' => 'Password harus memiliki panjang minimal 8 karakter.',
]
);
if (Auth::attempt($credentials)) {
if (Auth::user()->status == 'Finished') {
$request->session()->regenerate();
if (ucwords(Auth::user()->role) == 'Admin') {
// return redirect()->route('admin.index');
return redirect()->intended('admin');
} else {
return redirect()->intended('user');
}
} else if(Auth::user()->status == 'Rejected'){
Session::flash('message', 'Akun ditolak karena tidak memenuhi persyaratan');
return redirect()->back();
} else {
Session::flash('message', 'Akun tidak ditemukan atau sedang dalam pengajuan');
return redirect()->back();
}
}
// $error = $credentials->errors();
// ->withInput($request->except('key'))
// ->withErrors($validator)
return redirect()
->back()
->withErrors($credentials)
->onlyInput('email');
}
/**
* Log the user out (Invalidate the token).
*
* @return \Illuminate\Http\JsonResponse
*/
public function logout(Request $request)
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect()->route('login');
}
public function register(Request $request)
{
$nama_depan = $request->get('nama-depan');
$nama_belakang = $request->get('nama-belakang');
$tanggal_lahir = $request->get('tanggal-lahir');
$new_password = $request->get('new-password');
$nik = $request->get('nik');
$email = $request->get('email');
$nohp = $request->get('nohp');
$alamat = $request->get('alamat');
$foto_ktp = '';
$foto_wajah = '';
$persentase_kemiripan = '0%';
$gender = $request->get('gender');
$kode_kelurahan = $request->get('kode-kelurahan');
$ktpBase64 = $request->request->get('ktp');
$wajahBase64 = $request->request->get('wajah');
$validatedData['email_verified_at'] = now();
if ($ktpBase64 && $wajahBase64) {
// Konversi string Base64 ke file gambar
$ktpFile = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $ktpBase64));
$wajahFile = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $wajahBase64));
$foto_ktp = 'Foto-KTP-' . $nama_depan . '-' . $nama_belakang . '.jpg';
$foto_wajah = 'Foto-Wajah-' . $nama_depan . '-' . $nama_belakang . '.jpg';
file_put_contents(public_path('storage/foto-ktp/' . $foto_ktp), $ktpFile);
file_put_contents(public_path('storage/foto-wajah/' . $foto_wajah), $wajahFile);
}
//OCR
try {
$fotoKTP = public_path('storage/foto-ktp/' . $foto_ktp);
$image = Image::make($fotoKTP);
$image->greyscale(); // Convert to grayscale
$image->contrast(10); // Increase contrast, adjust the value as needed
$preprocessedfotoKTP = public_path('storage/preprocessed/preprocessed_image.jpg');
$image->save($preprocessedfotoKTP);
$result = (new TesseractOCR($preprocessedfotoKTP))->run();
// (5) Normalize
$lines = explode("\n", $result);
$namaOCR = '';
$nikOCR = '';
$nikInputan = $nik;
$namaInputan = $nama_depan . ' ' . $nama_belakang;
foreach ($lines as $line) {
// Mencari NIK
if (strpos($line, $nikInputan) !== false) {
$nikOCR = preg_replace('/[^0-9]/', '', $line);
}
// Mencari nama
if (strpos($line, $namaInputan) !== false) {
$namaOCR = trim(substr($line, strpos($line, ':') + 1));
}
}
//Selesai
$persentase_kemiripan = (similar_text($nikInputan, $nikOCR, $percent) + similar_text($namaOCR, $namaOCR, $percent)) / 2;
// $status = 'Progress';
// if (similar_text($nikInputan, $nikOCR, $percent) >= 70 && similar_text($namaOCR, $namaOCR, $percent) >= 70) {
// $status = 'Progress';
// } else {
// $status = 'Progress';
// }
} catch (\Exception $e) {
// $status = 'Progress';
}
//OCR
//Deteksi wajah belum
$password = Hash::make($new_password);
$result = User::create([
'id' => Uuid::uuid4(),
'nama_depan' => $nama_depan,
'nama_belakang' => $nama_belakang,
'tanggal_lahir' => $tanggal_lahir,
'email' => $email,
'email_verified_at' => now(),
'password' => $password,
'nohp' => $nohp,
'nik' => $nik,
'alamat' => $alamat,
'foto_ktp' => $foto_ktp,
'foto_wajah' => $foto_wajah,
'foto_profil' => null,
'persentase_kemiripan' => $persentase_kemiripan,
'gender' => $gender,
'kode_kelurahan' => $kode_kelurahan,
'remember_token' => Str::random(10),
]);
if ($result) {
return response()->json([
'status' => true,
'message' => 'Akun anda sudah terdaftar dan butuh verifikasi hingga maksimal 1 hari kerja',
]);
} else {
return response()->json([
'status' => false,
'message' => 'Akun anda gagal terdaftar. Coba lagi! ' + $result,
]);
}
}
public function statusAkun($email)
{
$result = User::where('email', $email)->get();
if ($result->isNotEmpty()) {
return response()->json([
'status' => true,
'message' => $result,
]);
} else {
return response()->json([
'status' => false,
'message' => $result,
]);
}
}
public function cariProvinsi()
{
$data = Province::where('name', 'LIKE', '%' . strtoupper(request('q')) . '%')->paginate(10);
return response()->json($data);
}
public function cariKota($code)
{
$data = City::where('province_code', $code)
->where('name', 'LIKE', '%' . strtoupper(request('q')) . '%')
->paginate(10);
return response()->json($data);
}
public function cariKecamatan($code)
{
$data = District::where('city_code', $code)
->where('name', 'LIKE', '%' . strtoupper(request('q')) . '%')
->paginate(10);
return response()->json($data);
}
public function cariKelurahan($code)
{
$data = Village::where('district_code', $code)
->where('name', 'LIKE', '%' . strtoupper(request('q')) . '%')
->paginate(10);
return response()->json($data);
}
public function kirimKodeVerifikasi(Request $request)
{
$email = $request->get('email');
$code = $request->get('code');
$verificationEmail = [
'code' => $code,
'email' => $email,
];
try {
Mail::to($email)->send(new verificationMail($verificationEmail));
return response()->json([
'message' => 'Kode verifikasi berhasil dikirim ke email. Silahkan cek di email anda.',
'status' => true,
]);
} catch (\Exception $e) {
return response()->json([
'message' => 'Kode verifikasi gagal dikirim ke email. ' . $e,
'status' => false,
]);
}
}
public function getOcr()
{
//OCR
// dd(phpinfo());
try {
$fotoKTP = public_path('storage/foto-ktp/ktp.jpg');
$image = Image::make($fotoKTP);
$image->greyscale(); // Convert to grayscale
$image->contrast(10); // Increase contrast, adjust the value as needed
$preprocessedfotoKTP = public_path('storage/preprocessed/preprocessed_image.jpg');
$image->save($preprocessedfotoKTP);
$result = (new TesseractOCR($preprocessedfotoKTP))->run();
// (5) Normalize
$lines = explode("\n", $result);
$nikOCR = '';
$namaOCR = '';
$nikInputan = '3471140209790001';
$namaInputan = 'RIYANTO. SE';
foreach ($lines as $line) {
// Mencari NIK
if (strpos($line, $nikInputan) !== false) {
$nikOCR = preg_replace('/[^0-9]/', '', $line);
}
// Mencari nama
if (strpos($line, $namaInputan) !== false) {
$namaOCR = trim(substr($line, strpos($line, ':') + 1));
}
}
//Selesai
$persentase_kemiripan = (similar_text($nikInputan, $nikOCR, $percent) + similar_text($namaOCR, $namaOCR, $percent)) / 2;
// $status = 'Progress';
dd([$persentase_kemiripan, $lines]);
// if (similar_text($nikInputan, $nikOCR, $percent) >= 70 && similar_text($namaOCR, $namaOCR, $percent) >= 70) {
// $status = 'Progress';
// } else {
// $status = 'Progress';
// }
} catch (\Exception $e) {
// $status = 'Progress';
dd($e);
}
//OCR
}
}

View File

@ -1,58 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\RefundUser;
class RefundController extends Controller
{
public function create(Request $request)
{
$request->validate([
'reason_complaint' => 'required|string',
'transfer_proof' => 'required|image',
]);
// Ambil data tambahan dari database berdasarkan order_id atau informasi lain
$order = Order::where('order_id', $request->input('order_id'))->first();
// Buat objek RefundUser
$refund = new RefundUser();
$refund->order_id = $order->order_id; // Ambil data dari order
$refund->customer = $order->customer;
$refund->seller = $order->seller;
$refund->total = $order->total;
$refund->dueDate = $order->dueDate;
$refund->status = $order->status;
$refund->reason_complaint = $request->input('reason_complaint');
if ($request->hasFile('transfer_proof')) {
$image = $request->file('transfer_proof');
$imageName = time() . '.' . $image->getClientOriginalExtension();
$image->move(public_path('uploads'), $imageName);
$refund->transfer_proof = $imageName;
}
// Simpan data ke dalam database
$refund->save();
return redirect('/refund')->with('success', 'Pengembalian Berhasil Diajukan');
}
// detail pengajuan berdasarkan id
public function show($id)
{
$refund = Refund::findOrFail($id);
return view('refund.show', ['refund' => $refund]);
}
// menghapus pengajuan refund berdasarkan id
public function destroy($id) // Perbaikan pada penulisan "destroy"
{
$refund = Refund::findOrFail($id);
$refund->delete();
return redirect('/refund')->with('success', 'Pengembalian Berhasil Dihapus');
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Http\Controllers;
use App\Models\RefundDescription;
use Illuminate\Http\Request;
class RefundDescriptionController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(RefundDescription $refundDescription)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(RefundDescription $refundDescription)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, RefundDescription $refundDescription)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(RefundDescription $refundDescription)
{
//
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Http\Controllers;
use App\Models\TransactionDescription;
use Illuminate\Http\Request;
class TransactionDescriptionController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(TransactionDescription $transactionDescription)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(TransactionDescription $transactionDescription)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, TransactionDescription $transactionDescription)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(TransactionDescription $transactionDescription)
{
//
}
}

View File

@ -0,0 +1,144 @@
<?php
namespace App\Http\Controllers\User;
use App\Models\Contact;
use App\Models\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class UserContactController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$contacts = Contact::where('pemilik_kontak', Auth::user()->email)->get();
return view('user.contact.index', ['contacts' => $contacts]);
// dd($contacts);
}
public function getContact()
{
$data = DB::table('contacts')
->select('contacts.relasi_kontak', 'users.nama_depan', 'users.nama_belakang')
->join('users', 'contacts.relasi_kontak', '=', 'users.email')
->where('contacts.pemilik_kontak','=',Auth::user()->email)
->paginate(10);
return response()->json($data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$email_relasi = $request->input('email');
if ($email_relasi == Auth::user()->email) {
return response()->json([
'status' => false,
'message' => 'Kontak yang ingin didaftarkan tidak boleh sama',
]);
} else {
$result = Contact::create([
'pemilik_kontak' => Auth::user()->email,
'relasi_kontak' => $request->input('email'),
]);
if ($result) {
return response()->json([
'status' => true,
'message' => 'Akun berhasil masuk ke kontak',
]);
} else {
return response()->json([
'status' => false,
'message' => 'Akun gagal masuk ke kontak',
]);
}
}
}
/**
* Display the specified resource.
*/
public function show(Contact $contact)
{
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Contact $contact)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Contact $contact)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Contact $contact, $id)
{
try {
$result = Contact::destroy($id);
if ($result) {
return response()->json([
'message' => 'Berhasil hapus data',
'status' => true,
]);
} else {
return response()->json([
'message' => 'Gagal hapus data karena ' . $result,
'status' => false,
]);
}
} catch (\Exception $e) {
return response()->json([
'message' => 'Gagal hapus data, karena ' . $e,
'status' => false,
]);
}
}
public function cekEmail($email)
{
$result = User::where('email', $email)->get();
if ($result->isNotEmpty() && $result[0]->role == 'User' && $result[0]->status != 'Rejected') {
if ($result[0]->status == 'Finished') {
return response()->json([
'status' => true,
'message' => $result,
]);
} else {
return response()->json([
'status' => false,
'message' => 'Akun dengen email ' . $email . ' tersedia dan belum diverifikasi',
]);
}
} else {
return response()->json([
'status' => false,
'message' => 'Akun dengen email ' . $email . ' tidak tersedia atau ditolak',
]);
}
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\RefundUser;
class UserDashboardController extends Controller
{
public function index(){
return view('user.index',[
"refundUserss"=>RefundUser::HistoryRefundUser()
]);
}
public function profile(){
return view('user.profile.index');
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Controllers\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\RefundUser;
class UserRefundController extends Controller
{
public function index()
{
return view('user.refund.index', [
'name' => 'npannisa',
'refundUserss' => RefundUser::HistoryRefundUser(),
]);
}
public function createRefund(Request $request)
{
return view('user.refund.new-refund');
}
public function historyRefund($id){
return view('user.transaction.pembeli.history-refund',[
'name'=>'npannisa',
"refundUserss"=>RefundUser::HistoryRefundUser()
]);
}
}

View File

@ -0,0 +1,280 @@
<?php
namespace App\Http\Controllers\User;
use App\Models\Transaction;
use App\Models\TransactionDescription;
use App\Http\Controllers\Controller;
use App\Models\Setting;
use Illuminate\Http\Request;
use App\Models\TransactionUser;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Auth;
use Ramsey\Uuid\Uuid;
use Midtrans\Config;
use Midtrans\Snap;
use Midtrans\Transaction as Trans;
class UserTransactionController extends Controller
{
/**
* Display a listing of the resource.
*/
public function indexPembeli()
{
return view('user.transaction.pembeli.index', [
'transactions' => Transaction::where('pembeli', Auth::user()->email)
->latest()
->get(),
]);
// dd(Transaction::where('pembeli',Auth::user()->email)->get());
}
/**
* Display a listing of the resource.
*/
public function indexPenjual()
{
return view('user.transaction.penjual.index', [
'transactions' => Transaction::where('penjual', Auth::user()->email)->get(),
]);
}
public function detailTransaction($id)
{
return view('user.transaction.pembeli.detail-transaction', [
'transaction' => Transaction::findOrFail($id),
'trackings' => TransactionDescription::where('order_id', $id)->get(),
]);
// dd(Transaction::findOrFail($id));
}
/**
* Show the form for creating a new resource.
*/
public function createTransaction(Request $request)
{
return view('user.transaction.pembeli.new-transaction');
}
/**
* Store a newly created resource in storage.
*/
public function invoiceTransaction($id)
{
return view('user.transaction.pembeli.invoice-transaction', [
'name' => 'npannisa',
'TransactionUser' => TransactionUser::HistoryTransaction(),
]);
}
public function storeTransaction(Request $request)
{
$pembeli = Auth::user()->email;
$penjual = $request->get('email_penjual');
$nama_barang = $request->get('nama_barang');
$satuan_barang = $request->get('satuan_barang');
$deskripsi_transaksi = $request->get('deskripsi');
$harga_barang = $request->get('harga_barang');
$jumlah_barang = $request->get('jumlah_barang');
$nama_depan_pembeli = Auth::user()->nama_depan;
$nama_belakang_pembeli = Auth::user()->nama_belakang;
$nohp_pembeli = Auth::user()->nohp;
$nama_penjual = User::where('email', $penjual)->value('nama_depan');
$alamat = ucwords(strtolower(Auth::user()->alamat));
$id = Uuid::uuid4();
$now = Carbon::now()->tz('Asia/Jakarta');
$bulan = $now->format('F');
$tahun = $now->year;
// $persentase_keuntungan = Setting::where('status','Active')
// ->where('bulan','=',$bulan)
// ->where('tahun','=',$tahun)->get();
$persentase_keuntungan = $request->get('persentase_keuntungan');
$total_harga = $request->get('total_harga');
$total_keuntungan = $request->get('total_keuntungan');
$total_bayar = $request->get('total_bayar');
$batas_pembayaran = $now->addDays(1)->toDateTimeString();
$batas_pengiriman_barang_awal = $now->addDays(2)->toDateTimeString();
$batas_pengiriman_barang_akhir = $now->addDays(5)->toDateTimeString();
$params = [
'transaction_details' => [
'order_id' => $id,
'gross_amount' => $total_bayar,
],
'item_details' => [
[
'id' => $nama_barang . time(),
'price' => $harga_barang,
'quantity' => $jumlah_barang,
'name' => $nama_barang,
],
[
'id' => 'BA01',
'price' => $total_keuntungan,
'quantity' => 1,
'name' => 'Biaya Admin',
],
],
'customer_details' => [
'firts_name' => $nama_depan_pembeli,
'last_name' => $nama_belakang_pembeli,
'email' => $pembeli,
'phone' => $nohp_pembeli,
'billing' => [
'first_name' => $nama_depan_pembeli,
'last_name' => $nama_belakang_pembeli,
'email' => $pembeli,
'phone' => $nohp_pembeli,
'address' => Auth::user()->alamat,
'city' => Auth::user()->village->district->city->name,
'country_code' => 'IDN',
],
],
'callbacks' => [
'finish' => 'http://127.0.0.1:8000/user/user-transaction-pembeli/',
],
'expiry' => [
'start_time' => $now->format('Y-m-d H:i:s P'),
'unit' => 'hours',
'duration' => 24,
],
];
Config::$serverKey = 'SB-Mid-server-8rydZAwKoWuoQ6g_3ot0-K7p';
Config::$isProduction = false;
// Set sanitization on (default)
Config::$isSanitized = true;
// Set 3DS transaction for credit card to true
Config::$is3ds = true;
$snap_token = Snap::getSnapToken($params);
$token = $snap_token;
$status = 'pending';
$query = Transaction::create([
'id' => $id,
'pembeli' => $pembeli,
'penjual' => $penjual,
'nama_barang' => $nama_barang,
'deskripsi_transaksi' => $deskripsi_transaksi,
'satuan_barang' => $satuan_barang,
'harga_barang' => $harga_barang,
'jumlah_barang' => $jumlah_barang,
'persentase_keuntungan' => $persentase_keuntungan,
'total_keuntungan' => $total_keuntungan,
'total_harga' => $total_harga,
'total_bayar' => $total_bayar,
'token' => $token,
'status' => $status,
'batas_pembayaran' => $batas_pembayaran,
'batas_pengiriman_barang_awal' => $batas_pengiriman_barang_awal,
'batas_pengiriman_barang_akhir' => $batas_pengiriman_barang_akhir,
]);
if ($query) {
TransactionDescription::create([
'order_id' => $id,
'status' => $status,
'user' => $pembeli,
'judul' => 'fa fa-plus',
'background' => 'bg-buyer',
'deskripsi' => $nama_depan_pembeli . ' telah membuat transaksi baru dengan ' . $nama_penjual,
]);
return response()->json([
'status' => true,
'message' => 'Berhasil menambahkan transaksi. Silahkan lakukan pembayaran.',
]);
} else {
return response()->json([
'status' => false,
'message' => 'Gagal menambahkan transaksi.',
]);
}
}
public function updateStatusTransaction(Request $request)
{
}
public function acceptTransaction(Request $request)
{
}
public function paymentTransaction(Request $request, $id)
{
Config::$serverKey = 'SB-Mid-server-8rydZAwKoWuoQ6g_3ot0-K7p';
Config::$isProduction = false;
// Set sanitization on (default)
Config::$isSanitized = true;
// Set 3DS transaction for credit card to true
Config::$is3ds = true;
$payment = Trans::status($id);
$result = json_decode(json_encode($payment), true);
$query = Transaction::where('id', $id)->update([
'acquire' => $result['acquirer'],
'currency' => $result['currency'],
'fraud_status' => $result['fraud_status'],
'issuer' => $result['issuer'],
'merchant_id' => $result['merchant_id'],
'metode_pembayaran' => $result['payment_type'],
'tanggal_pembayaran' => $result['settlement_time'],
'signature_key' => $result['signature_key'],
'status' => $result['transaction_status'],
'tipe_transaction' => $result['transaction_type'],
'status_code' => $result['status_code'],
]);
if ($query) {
return response()->json([
'status' => true,
'message' => 'Pembayaran sukses. Proses akan dilanjutkan ke penjual',
]);
} else {
return response()->json([
'status' => false,
'message' => 'Pembayaran gagal',
]);
}
}
/**
* Display the specified resource.
*/
public function show(Transaction $transaction)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Transaction $transaction)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Transaction $transaction)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Transaction $transaction)
{
//
}
}

View File

@ -1,15 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserController extends Controller
{
public function store(Request $request) {
invoice::create([
]);
alert::success('Pembayaran Berhasil!', 'Pembayaran Gagal');
}
}

View File

@ -1,77 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class pembayaranController extends Controller
{
public function index(Request $request) {
return view('user.payment.test');
}
public function payment (request $request) {
dd($request);
// Set your Merchant Server Key
\Midtrans\Config::$serverKey = env('MIDTRANS_SERVER_KEY');
// Set to Development/Sandbox Environment (default). Set to true for Production Environment (accept real transaction).
\Midtrans\Config::$isProduction = false;
// Set sanitization on (default)
\Midtrans\Config::$isSanitized = true;
// Set 3DS transaction for credit card to true
\Midtrans\Config::$is3ds = true;
$params = array(
'transaction_details' => array(
'order_id' => rand(),
'gross_amount' => 10000,
),
"item_details" => array(
[
"id" => 'a1',
"price" => "5000",
"quantity" => '3',
"name" => 'Ayam'
],
[
"id" => 'b1',
"price" => "10000",
"quantity" => '2',
"name" => 'Thai Tea'
]
),
'customer_details' => array(
// 'nama' => 'Nurul Prima Annisa',
// "email" => 'npannisa23@gmail.com',
// "no hp" => '+6282284964524',
'email' => $request->get('email'),
'nominal' => $request->get('nominal'),
'tujuan' => $request->get('tujuan'),
'deskripsi' => $request->get('desk'),
),
);
$snapToken = \Midtrans\Snap::getSnapToken($params);
return view('user.payment.payment', ['snap_token'=>$snapToken]);
}
public function payment_post(Request $request) {
$json = json_decode($request->get('json'));
dd($json);
$payment = new Payment();
$payment->status = $json->transaction_status;
$payment->email = $request->get('email');
$payment->nominal = $request->get('nominal');
$payment->tujuan = $request->get('tujuan');
$payment->deskripsi = $request->get('deskripsi');
$payment->transaction_id = $json->transaction_id;
$payment->order_id = $json->order_id;
$payment->gross_amount = $json-> gross_amount;
$payment->payment_type = $json ->payment_type;
$payment->payment_code =isset($json->payment_code) ? $json->payment_code : null;
$payment->pdf_url =isset($json->pdf_url) ? $json->pdf_url : null;
return $payment->save() ? redirect(url('test'))->with('alert-succes', 'Payment Berhasil'): redirect(url('test'))->with('alert-failed', 'Terjadi Kesalahan');
dd($result);
}
}

View File

@ -64,5 +64,7 @@ class Kernel extends HttpKernel
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'admin' => \App\Http\Middleware\Admin::class,
'user' => \App\Http\Middleware\User::class,
];
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Support\Facades\Auth;
class Admin
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if(Auth::user()->role != 'Admin'){
return redirect()->back();
}
return $next($request);
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Support\Facades\Auth;
class User
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if(Auth::user()->role != 'User'){
return redirect()->back();
}
return $next($request);
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreRefundUserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreSettingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreUsersRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StorepaymentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRefundUserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateSettingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateUsersRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdatepaymentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class verificationMail extends Mailable
{
use Queueable, SerializesModels;
public $verificationEmail;
/**
* Create a new message instance.
*/
public function __construct($verificationEmail)
{
$this->verificationEmail = $verificationEmail;
}
/**
* Get the message envelope.
*/
// public function envelope(): Envelope
// {
// return new Envelope(
// subject: 'Verification Mail',
// );
// }
/**
* Get the message content definition.
*/
// public function content(): Content
// {
// return new Content(
// view: 'view.name',
// );
// }
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
// public function attachments(): array
// {
// return [];
// }
public function build(){
return $this->subject('Kode Verifikasi')->view('email.verification-email');
}
}

32
app/Models/Contact.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Contact extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'pemilik_kontak',
'relasi_kontak',
];
//Relasi
public function pemilikKontak(){
return $this->belongsTo(User::class, 'pemilik_kontak', 'email');
}
public function relasiKontak(){
return $this->belongsTo(User::class, 'relasi_kontak', 'email');
}
//Relasi
}

View File

@ -1,41 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ContactUser
{
private static $ContactUser=[
[
"email"=>"npannisa@gmail.com",
"name"=> "Nurul Prima",
"phone"=>"+6284964524"
],
[
"email"=>"asfii@gmail.com",
"name"=> "Rayhan Arevii",
"phone"=>"+6284974524"
],
[
"email"=>"Raihan@gmail.com",
"name"=> "Rayhan Surya",
"phone"=>"+6264746472"
],
[
"email"=>"viona@gmail.com",
"name"=> "Viona Denopta",
"phone"=>"+6264776747"
],
[
"email"=>"fatur@gmail.com",
"name"=> "Fatur Rahman",
"phone"=>"+62647864733"
],
];
public static function ContactUser(){
return self::$ContactUser;
}
}

29
app/Models/Refund.php Normal file
View File

@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Refund extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'order_id',
'total',
'due_date',
'status',
];
//Relasi
public function orders(){
return $this->belongsTo(Transaction::class, 'id', 'order_id');
}
//Relasi
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class RefundDescription extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'refund_id',
'filename',
'type',
];
//Relasi
public function refunds(){
return $this->belongsTo(Refund::class, 'refund_id', 'id');
}
//Relasi
}

View File

@ -7,6 +7,8 @@ use Illuminate\Database\Eloquent\Model;
class RefundUser
{
// use HasFactory;
private static $history_refundUser=[
[
"orderId" => "INV-1234",
@ -15,34 +17,25 @@ class RefundUser
"Total" => " Rp.200.000",
"dueDate"=>"29 juni 2023",
"status"=>"diterima",
"uploadBukti" => "5.jpg"
],
[
"orderId" => "INV-1235",
"Customer" => "jilhan haura",
"seller" => "kevin",
"Total" => " Rp.500.000",
"dueDate"=>"29 Januari 2023",
"status"=>"diproses",
],
[
"orderId" => "INV-1236",
"Customer" => "Raihan Surya",
"seller" => "Salsa",
"Total" => " Rp.400.000",
"dueDate"=>"20 Agustus 2023",
"orderId" => "INV-1234",
"Customer" => "hantu",
"seller" => "rayhan",
"Total" => " Rp.200.000",
"dueDate"=>"29 juni 2023",
"status"=>"ditolak",
"uploadBukti" => "5.jpg"
],
[
"orderId" => "INV-1237",
"Customer" => "Fatur Rahman",
"seller" => "Satria ",
"Total" => " Rp.100.000",
"dueDate"=>"2 Agustus 2023",
"status"=>"ditolak",
"orderId" => "INV-1234",
"Customer" => "pocong",
"seller" => "rayhan",
"Total" => " Rp.200.000",
"dueDate"=>"29 juni 2023",
"status"=>"diterima",
"uploadBukti" => "5.jpg"
],
];
public static function HistoryRefundUser(){

80
app/Models/Refunds.php Normal file
View File

@ -0,0 +1,80 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
// class Refund extends Model{
// protected $table = 'refund';
// use HasFactory;
// }
class Refunds
{
private static $history_refund=[
[
"no"=>"1",
"orderId" => "INV-1234",
"customer" => "Okta",
"seller" => "dodo",
"total" => "Rp. 15000",
"date" => "July 19, 2023 ",
"status"=>"Process Refund"
],
[
"no"=>"2",
"orderId" => "INV-0000",
"customer" => "Selvi",
"seller" => "dedo",
"total" => "Rp. 11000",
"date" => "August 19, 2023 ",
"status"=>"Refund Success"
],
[
"no"=>"3",
"orderId" => "INV-2313",
"customer" => "Septa",
"seller" => "dido",
"total" => "Rp. 15000",
"date" => "July 29, 2023 ",
"status"=>"Process Refund"
],
[
"no"=>"4",
"orderId" => "INV-5664",
"customer" => "Padia",
"seller" => "dedo",
"total" => "Rp. 14000",
"date" => "July 18, 2023 ",
"status"=>"Refunds Refused"
],
[
"no"=>"5",
"orderId" => "INV-9090",
"customer" => "hantu",
"seller" => "dado",
"total" => "Rp. 45000",
"date" => "2023-08-14 ",
"status"=>"Refunds Refused"
]
];
public static $detail_refund=[
[
"orderId" => "INV-9090",
"customer" => "hantu",
"seller" => "dado",
"total" => "Rp. 45000",
"date" => "2023-08-14 ",
"complaint" =>" Lorem ipsum dolor sit, amet consectetur adipisicing elit. Aliquam inventore, sit enim iure itaque fuga voluptates alias, eveniet quos ex reiciendis! Dolore mollitia ea inventore, excepturi hic fugiat id, magnam molestias sint ut enim repellendus, cum dolorum dolores sapiente adipisci tempora nihil omnis! Accusantium, non perspiciatis? Molestias modi debitis perferendis reprehenderit excepturi voluptates? Sit incidunt consequuntur iusto odit sapiente inventore nemo commodi, quam vero magnam temporibus ducimus praesentium assumenda blanditiis possimus perferendis totam placeat maiores. Quae ut id libero atque pariatur veritatis rerum culpa tempore consequatur quod corrupti corporis nobis quia repellendus iste quidem illum, voluptates aspernatur cumque officia. Tenetur.",
"image"=>"assets/images/dashboard/img_2.jpg"
]
];
public static function HistoryRefund(){
return self::$history_refund;
}
public static function DetailRefund(){
return self::$detail_refund;
}
}

23
app/Models/Setting.php Normal file
View File

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'bulan',
'tahun',
'persentase',
'status',
];
}

50
app/Models/Settings.php Normal file
View File

@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Settings
{
static $History_Setting=[
[
"no" => "1",
"month" => "January",
"year" =>"2021",
"persentase" =>"50%",
"status" =>"Active"
],
[
"no" => "2",
"month" => "February",
"year" =>"2022",
"persentase" =>"40%",
"status" =>"Non Active"
],
[
"no" => "3",
"month" => "March",
"year" =>"2023",
"persentase" =>"30%",
"status" =>"Non Active"
],
[
"no" => "4",
"month" => "April",
"year" =>"2021",
"persentase" =>"60%",
"status" =>"Non Active"
],
[
"no" => "5",
"month" => "May",
"year" =>"2023",
"persentase" =>"20%",
"status" =>"Non Active"
]
];
public static function HistorySetting(){
return self::$History_Setting;
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TransactionDescription extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'order_id',
'user',
'judul',
'status',
'background',
'deskripsi'
];
//Relasi
public function order(){
return $this->belongsTo(Transaction::class, 'id', 'order_id');
}
public function user(){
return $this->belongsTo(User::class, 'email', 'user');
}
//Relasi
}

View File

@ -1,51 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TransactionPembeli
{
private static $history_transactionPembeli=[
[
"userId" => "NPA-9876",
"orderId" => "INV-1234",
"seller" => "Jilhan Haura",
"total" => "Rp.500.000",
"dueDate"=>"29 juni 2023",
"status"=>"OnProgress",
"action" => ""
],
[
"userId" => "NPA-9877",
"orderId" => "INV-12345",
"seller" => "Rayhan Surya",
"total" => "Rp.900.000",
"dueDate"=>"30 juni 2023",
"status"=>"Failed",
"action" => ""
],
[
"userId" => "NPA-9878",
"orderId" => "INV-12346",
"seller" => "Satria Hikmaladi",
"total" => "Rp.900.000",
"dueDate"=>"31 juni 2023",
"status"=>"Success",
"action" => ""
],
[
"userId" => "NPA-9871",
"orderId" => "INV-12340",
"seller" => "Aliffian Septi",
"total" => "Rp.1.000.000",
"dueDate"=>"13 Maret 2023",
"status"=>"Failed",
"action" => ""
],
];
public static function HistoryTransactionPembeli(){
return self::$history_transactionPembeli;
}
}

View File

@ -1,52 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TransactionPenjual
{
private static $history_transactionPenjual=[
[
"userId" => "NPA-9876",
"orderId" => "INV-1235",
"customer" => "Viona Denopta",
"total" => "Rp.500.000",
"dueDate"=>"29 juni 2023",
"status"=>"OnProgress",
"action" => ""
],
[
"userId" => "NPA-9877",
"orderId" => "INV-1236",
"customer" => "Intan Saudina Fitri",
"total" => "Rp.1.500.000",
"dueDate"=>"29 September 2023",
"status"=>"Success",
"action" => ""
],
[
"userId" => "NPA-9879",
"orderId" => "INV-1238",
"customer" => "Cindy Zahra",
"total" => "Rp.5.000.000",
"dueDate"=>"09 juni 2023",
"status"=>"Failed",
"action" => ""
],
[
"userId" => "NPA-9872",
"orderId" => "INV-1232",
"customer" => "Naufal Hady",
"total" => "Rp.500.000",
"dueDate"=>"05 Desember 2023",
"status"=>"Failed",
"action" => ""
],
];
public static function HistoryTransactionPenjual(){
return self::$history_transactionPenjual;
}
}

View File

@ -3,7 +3,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TransactionUser
{

View File

@ -0,0 +1,90 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Transactions
{
private static $list_transaction = [
[
'no' => '1',
'orderId' => 'INV-1234',
'customer' => 'Jilhan',
'seller' => 'dodo',
'total' => 'Rp. 15000',
'date' => 'July 19, 2023 ',
'status' => 'paid',
],
[
'no' => '2',
'orderId' => 'INV-0000',
'customer' => 'hmmm',
'seller' => 'dodo',
'total' => 'Rp. 11000',
'date' => 'August 19, 2023 ',
'status' => 'pending',
],
[
'no' => '3',
'orderId' => 'INV-2313',
'customer' => 'nurul',
'seller' => 'dido',
'total' => 'Rp. 15000',
'date' => 'July 29, 2023 ',
'status' => 'unpaid',
],
[
'no' => '4',
'orderId' => 'INV-5664',
'customer' => 'raihan',
'seller' => 'dedo',
'total' => 'Rp. 14000',
'date' => 'July 18, 2023 ',
'status' => 'pending',
],
[
'no' => '5',
'orderId' => 'INV-9090',
'customer' => 'testing',
'seller' => 'dado',
'total' => 'Rp. 45000',
'date' => 'June 19, 2023 ',
'status' => 'paid',
],
];
private static $detail_transaction = [
[
'idTransaction' => 'INV-76899',
'side' => 'SELL',
'marketPair' => 'IDR',
'email' => 'JilhanHaura07@gmail.com',
'amountTransaction' => 'Rp. 900000',
'feeTransaction' => '10%',
'total' => '68,00989.00 IDR',
'paymentDetail' => 'Bank',
'bankName' => 'BNI',
'accountNumber' => '123',
'statusTransaction' => 'Success',
// "tracking_number" => "09102919209",
// "orderId" => "INV-9090",
// "status"=>"Pending",
// "estimated" => "June 20, 2023",
// "tracking_detail1"=> "August 10: processed payment",
// "tracking_detail2"=> "August 12: payment in system",
// "tracking_detail3"=> "August 14: payment has been received by the seller",
],
];
public static function allTransactions()
{
return self::$list_transaction;
}
public static function allDetailTransactions()
{
return self::$detail_transaction;
}
}

View File

@ -7,6 +7,8 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
class User extends Authenticatable
{
@ -18,9 +20,24 @@ class User extends Authenticatable
* @var array<int, string>
*/
protected $fillable = [
'name',
'id',
'nama_depan',
'nama_belakang',
'tanggal_lahir',
'nik',
'email',
'password',
'role',
'nohp',
'alamat',
'foto_ktp',
'foto_wajah',
'foto_profil',
'persentase_kemiripan',
'status',
'gender',
'kode_kelurahan',
'remember_token',
];
/**
@ -41,5 +58,72 @@ class User extends Authenticatable
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'id' => 'string',
'status' => 'string',
];
//JWT
/**
* Get the identifier that will be stored in the subject claim of the JWT.
*
* @return mixed
*/
public function getJWTIdentifier()
{
return $this->getKey();
}
/**
* Return a key value array, containing any custom claims to be added to the JWT.
*
* @return array
*/
public function getJWTCustomClaims()
{
return [];
}
//JWT
//Relasi
public function pemilik_kontak(){
return $this->hasMany(Contact::class, 'email', 'pemilik_kontak');
}
public function relasi_kontak(){
return $this->hasMany(Contact::class, 'email', 'relasi_kontak');
}
public function pembeli(){
return $this->hasMany(Transaction::class, 'email', 'pembeli');
}
public function penjual(){
return $this->hasMany(Transaction::class, 'email', 'penjual');
}
public function village(){
return $this->belongsTo('Laravolt\Indonesia\Models\Village', 'kode_kelurahan', 'code');
}
//Relasi
//function alamat
public function getVillageName(){
return $this->village->name;
}
public function getDistrictName(){
return $this->village->district->name;
}
public function getCityName(){
return $this->village->district->city->name;
}
public function getProvinceName(){
return $this->village->district->city->province->name;
}
}

View File

@ -1,12 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class payment extends Model
{
use HasFactory;
protected $guarded = []; //agar dapat mengisi keseluruhan table
}

View File

@ -0,0 +1,61 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Transaction extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'id',
'pembeli',
'penjual',
'nama_barang',
'deskripsi_transaksi',
'satuan_barang',
'harga_barang',
'jumlah_barang',
'persentase_keuntungan',
'total_keuntungan',
'total_harga',
'total_bayar',
'token',
'status',
'batas_pembayaran',
'batas_pengiriman_barang_awal',
'batas_pengiriman_barang_akhir',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'batas_pembayaran' => 'datetime',
'batas_pengiriman_barang' => 'datetime',
'id' => 'string',
];
//Relasi
public function data_pembeli(){
return $this->belongsTo(User::class, 'pembeli', 'email');
}
public function data_penjual(){
return $this->belongsTo(User::class, 'penjual', 'email');
}
public function refunds(){
return $this->hasMany(Refund::class, 'order_id', 'id');
}
//Relasi
}

View File

@ -1,66 +0,0 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\payment;
use Illuminate\Auth\Access\Response;
class PaymentPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, payment $payment): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, payment $payment): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, payment $payment): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, payment $payment): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, payment $payment): bool
{
//
}
}

View File

@ -1,66 +0,0 @@
<?php
namespace App\Policies;
use App\Models\RefundUser;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class RefundUserPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, RefundUser $refundUser): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, RefundUser $refundUser): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, RefundUser $refundUser): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, RefundUser $refundUser): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, RefundUser $refundUser): bool
{
//
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class SettingPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Setting $setting): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Setting $setting): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Setting $setting): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Setting $setting): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Setting $setting): bool
{
//
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\Users;
use Illuminate\Auth\Access\Response;
class UsersPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
//
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Users $users): bool
{
//
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
//
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, Users $users): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Users $users): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Users $users): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Users $users): bool
{
//
}
}

View File

@ -2,16 +2,25 @@
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"keywords": [
"laravel",
"framework"
],
"license": "MIT",
"require": {
"php": "^8.1",
"guzzlehttp/guzzle": "^7.2",
"intervention/image": "^2.7",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"laravolt/indonesia": "^0.34.0",
"midtrans/midtrans-php": "^2.5",
"realrashid/sweet-alert": "^7.1"
"nesbot/carbon": "^2.69",
"pusher/pusher-php-server": "^7.2",
"ramsey/uuid": "^4.7",
"thiagoalessio/tesseract_ocr": "^2.12",
"tymon/jwt-auth": "^2.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",

1225
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -109,7 +109,7 @@ return [
|
*/
'faker_locale' => 'en_US',
'faker_locale' => 'id_ID',
/*
|--------------------------------------------------------------------------
@ -159,7 +159,6 @@ return [
/*
* Package Service Providers...
*/
RealRashid\SweetAlert\SweetAlertServiceProvider::class,
/*
* Application Service Providers...
@ -185,6 +184,5 @@ return [
'aliases' => Facade::defaultAliases()->merge([
// 'Example' => App\Facades\Example::class,
])->toArray(),
'Alert' => RealRashid\SweetAlert\Facades\Alert::class,
];

View File

@ -40,6 +40,10 @@ return [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'jwt',
'provider' => 'users',
]
],
/*

View File

@ -35,13 +35,17 @@ return [
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
// 'options' => [
// 'cluster' => env('PUSHER_APP_CLUSTER'),
// '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',
// ],
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'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',
'cluster' => 'ap1',
'useTLS' => true,
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html

80
config/flare.php Normal file
View File

@ -0,0 +1,80 @@
<?php
use Spatie\FlareClient\FlareMiddleware\AddGitInformation;
use Spatie\FlareClient\FlareMiddleware\RemoveRequestIp;
use Spatie\FlareClient\FlareMiddleware\CensorRequestBodyFields;
use Spatie\FlareClient\FlareMiddleware\CensorRequestHeaders;
use Spatie\LaravelIgnition\FlareMiddleware\AddDumps;
use Spatie\LaravelIgnition\FlareMiddleware\AddEnvironmentInformation;
use Spatie\LaravelIgnition\FlareMiddleware\AddExceptionInformation;
use Spatie\LaravelIgnition\FlareMiddleware\AddJobs;
use Spatie\LaravelIgnition\FlareMiddleware\AddLogs;
use Spatie\LaravelIgnition\FlareMiddleware\AddQueries;
use Spatie\LaravelIgnition\FlareMiddleware\AddNotifierName;
return [
/*
|
|--------------------------------------------------------------------------
| Flare API key
|--------------------------------------------------------------------------
|
| Specify Flare's API key below to enable error reporting to the service.
|
| More info: https://flareapp.io/docs/general/projects
|
*/
'key' => env('FLARE_KEY'),
/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
|
| These middleware will modify the contents of the report sent to Flare.
|
*/
'flare_middleware' => [
RemoveRequestIp::class,
AddGitInformation::class,
AddNotifierName::class,
AddEnvironmentInformation::class,
AddExceptionInformation::class,
AddDumps::class,
AddLogs::class => [
'maximum_number_of_collected_logs' => 200,
],
AddQueries::class => [
'maximum_number_of_collected_queries' => 200,
'report_query_bindings' => true,
],
AddJobs::class => [
'max_chained_job_reporting_depth' => 5,
],
CensorRequestBodyFields::class => [
'censor_fields' => [
'password',
'password_confirmation',
],
],
CensorRequestHeaders::class => [
'headers' => [
'API-KEY',
]
]
],
/*
|--------------------------------------------------------------------------
| Reporting log statements
|--------------------------------------------------------------------------
|
| If this setting is `false` log statements won't be sent as events to Flare,
| no matter which error level you specified in the Flare log channel.
|
*/
'send_logs_as_events' => true,
];

279
config/ignition.php Normal file
View File

@ -0,0 +1,279 @@
<?php
use Spatie\Ignition\Solutions\SolutionProviders\BadMethodCallSolutionProvider;
use Spatie\Ignition\Solutions\SolutionProviders\MergeConflictSolutionProvider;
use Spatie\Ignition\Solutions\SolutionProviders\UndefinedPropertySolutionProvider;
use Spatie\LaravelIgnition\Recorders\DumpRecorder\DumpRecorder;
use Spatie\LaravelIgnition\Recorders\JobRecorder\JobRecorder;
use Spatie\LaravelIgnition\Recorders\LogRecorder\LogRecorder;
use Spatie\LaravelIgnition\Recorders\QueryRecorder\QueryRecorder;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\DefaultDbNameSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\GenericLaravelExceptionSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\IncorrectValetDbCredentialsSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\InvalidRouteActionSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingAppKeySolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingColumnSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingImportSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingLivewireComponentSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingMixManifestSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\MissingViteManifestSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\RunningLaravelDuskInProductionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\TableNotFoundSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\UndefinedViewVariableSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\UnknownValidationSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\ViewNotFoundSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\OpenAiSolutionProvider;
use Spatie\LaravelIgnition\Solutions\SolutionProviders\SailNetworkSolutionProvider;
return [
/*
|--------------------------------------------------------------------------
| Editor
|--------------------------------------------------------------------------
|
| Choose your preferred editor to use when clicking any edit button.
|
| Supported: "phpstorm", "vscode", "vscode-insiders", "textmate", "emacs",
| "sublime", "atom", "nova", "macvim", "idea", "netbeans",
| "xdebug", "phpstorm-remote"
|
*/
'editor' => env('IGNITION_EDITOR', 'phpstorm'),
/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| Here you may specify which theme Ignition should use.
|
| Supported: "light", "dark", "auto"
|
*/
'theme' => env('IGNITION_THEME', 'auto'),
/*
|--------------------------------------------------------------------------
| Sharing
|--------------------------------------------------------------------------
|
| You can share local errors with colleagues or others around the world.
| Sharing is completely free and doesn't require an account on Flare.
|
| If necessary, you can completely disable sharing below.
|
*/
'enable_share_button' => env('IGNITION_SHARING_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Register Ignition commands
|--------------------------------------------------------------------------
|
| Ignition comes with an additional make command that lets you create
| new solution classes more easily. To keep your default Laravel
| installation clean, this command is not registered by default.
|
| You can enable the command registration below.
|
*/
'register_commands' => env('REGISTER_IGNITION_COMMANDS', false),
/*
|--------------------------------------------------------------------------
| Solution Providers
|--------------------------------------------------------------------------
|
| You may specify a list of solution providers (as fully qualified class
| names) that shouldn't be loaded. Ignition will ignore these classes
| and possible solutions provided by them will never be displayed.
|
*/
'solution_providers' => [
// from spatie/ignition
BadMethodCallSolutionProvider::class,
MergeConflictSolutionProvider::class,
UndefinedPropertySolutionProvider::class,
// from spatie/laravel-ignition
IncorrectValetDbCredentialsSolutionProvider::class,
MissingAppKeySolutionProvider::class,
DefaultDbNameSolutionProvider::class,
TableNotFoundSolutionProvider::class,
MissingImportSolutionProvider::class,
InvalidRouteActionSolutionProvider::class,
ViewNotFoundSolutionProvider::class,
RunningLaravelDuskInProductionProvider::class,
MissingColumnSolutionProvider::class,
UnknownValidationSolutionProvider::class,
MissingMixManifestSolutionProvider::class,
MissingViteManifestSolutionProvider::class,
MissingLivewireComponentSolutionProvider::class,
UndefinedViewVariableSolutionProvider::class,
GenericLaravelExceptionSolutionProvider::class,
OpenAiSolutionProvider::class,
SailNetworkSolutionProvider::class,
],
/*
|--------------------------------------------------------------------------
| Ignored Solution Providers
|--------------------------------------------------------------------------
|
| You may specify a list of solution providers (as fully qualified class
| names) that shouldn't be loaded. Ignition will ignore these classes
| and possible solutions provided by them will never be displayed.
|
*/
'ignored_solution_providers' => [
],
/*
|--------------------------------------------------------------------------
| Runnable Solutions
|--------------------------------------------------------------------------
|
| Some solutions that Ignition displays are runnable and can perform
| various tasks. By default, runnable solutions are only enabled when your
| app has debug mode enabled and the environment is `local` or
| `development`.
|
| Using the `IGNITION_ENABLE_RUNNABLE_SOLUTIONS` environment variable, you
| can override this behaviour and enable or disable runnable solutions
| regardless of the application's environment.
|
| Default: env('IGNITION_ENABLE_RUNNABLE_SOLUTIONS')
|
*/
'enable_runnable_solutions' => env('IGNITION_ENABLE_RUNNABLE_SOLUTIONS'),
/*
|--------------------------------------------------------------------------
| Remote Path Mapping
|--------------------------------------------------------------------------
|
| If you are using a remote dev server, like Laravel Homestead, Docker, or
| even a remote VPS, it will be necessary to specify your path mapping.
|
| Leaving one, or both of these, empty or null will not trigger the remote
| URL changes and Ignition will treat your editor links as local files.
|
| "remote_sites_path" is an absolute base path for your sites or projects
| in Homestead, Vagrant, Docker, or another remote development server.
|
| Example value: "/home/vagrant/Code"
|
| "local_sites_path" is an absolute base path for your sites or projects
| on your local computer where your IDE or code editor is running on.
|
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
*/
'remote_sites_path' => env('IGNITION_REMOTE_SITES_PATH', base_path()),
'local_sites_path' => env('IGNITION_LOCAL_SITES_PATH', ''),
/*
|--------------------------------------------------------------------------
| Housekeeping Endpoint Prefix
|--------------------------------------------------------------------------
|
| Ignition registers a couple of routes when it is enabled. Below you may
| specify a route prefix that will be used to host all internal links.
|
*/
'housekeeping_endpoint_prefix' => '_ignition',
/*
|--------------------------------------------------------------------------
| Settings File
|--------------------------------------------------------------------------
|
| Ignition allows you to save your settings to a specific global file.
|
| If no path is specified, a file with settings will be saved to the user's
| home directory. The directory depends on the OS and its settings but it's
| typically `~/.ignition.json`. In this case, the settings will be applied
| to all of your projects where Ignition is used and the path is not
| specified.
|
| However, if you want to store your settings on a project basis, or you
| want to keep them in another directory, you can specify a path where
| the settings file will be saved. The path should be an existing directory
| with correct write access.
| For example, create a new `ignition` folder in the storage directory and
| use `storage_path('ignition')` as the `settings_file_path`.
|
| Default value: '' (empty string)
*/
'settings_file_path' => '',
/*
|--------------------------------------------------------------------------
| Recorders
|--------------------------------------------------------------------------
|
| Ignition registers a couple of recorders when it is enabled. Below you may
| specify a recorders will be used to record specific events.
|
*/
'recorders' => [
DumpRecorder::class,
JobRecorder::class,
LogRecorder::class,
QueryRecorder::class,
],
/*
* When a key is set, we'll send your exceptions to Open AI to generate a solution
*/
'open_ai_key' => env('IGNITION_OPEN_AI_KEY'),
/*
|--------------------------------------------------------------------------
| Include arguments
|--------------------------------------------------------------------------
|
| Ignition show you stack traces of exceptions with the arguments that were
| passed to each method. This feature can be disabled here.
|
*/
'with_stack_frame_arguments' => true,
/*
|--------------------------------------------------------------------------
| Argument reducers
|--------------------------------------------------------------------------
|
| Ignition show you stack traces of exceptions with the arguments that were
| passed to each method. To make these variables more readable, you can
| specify a list of classes here which summarize the variables.
|
*/
'argument_reducers' => [
\Spatie\Backtrace\Arguments\Reducers\BaseTypeArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\ArrayArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\StdClassArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\EnumArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\ClosureArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\DateTimeArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\DateTimeZoneArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\SymphonyRequestArgumentReducer::class,
\Spatie\LaravelIgnition\ArgumentReducers\ModelArgumentReducer::class,
\Spatie\LaravelIgnition\ArgumentReducers\CollectionArgumentReducer::class,
\Spatie\Backtrace\Arguments\Reducers\StringableArgumentReducer::class,
],
];

20
config/image.php Normal file
View File

@ -0,0 +1,20 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Image Driver
|--------------------------------------------------------------------------
|
| Intervention Image supports "GD Library" and "Imagick" to process images
| internally. You may choose one of them according to your PHP
| configuration. By default PHP's "GD Library" implementation is used.
|
| Supported: "gd", "imagick"
|
*/
'driver' => 'gd'
];

301
config/jwt.php Normal file
View File

@ -0,0 +1,301 @@
<?php
/*
* This file is part of jwt-auth.
*
* (c) Sean Tymon <tymon148@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
/*
|--------------------------------------------------------------------------
| JWT Authentication Secret
|--------------------------------------------------------------------------
|
| Don't forget to set this in your .env file, as it will be used to sign
| your tokens. A helper command is provided for this:
| `php artisan jwt:secret`
|
| Note: This will be used for Symmetric algorithms only (HMAC),
| since RSA and ECDSA use a private/public key combo (See below).
|
*/
'secret' => env('JWT_SECRET'),
/*
|--------------------------------------------------------------------------
| JWT Authentication Keys
|--------------------------------------------------------------------------
|
| The algorithm you are using, will determine whether your tokens are
| signed with a random string (defined in `JWT_SECRET`) or using the
| following public & private keys.
|
| Symmetric Algorithms:
| HS256, HS384 & HS512 will use `JWT_SECRET`.
|
| Asymmetric Algorithms:
| RS256, RS384 & RS512 / ES256, ES384 & ES512 will use the keys below.
|
*/
'keys' => [
/*
|--------------------------------------------------------------------------
| Public Key
|--------------------------------------------------------------------------
|
| A path or resource to your public key.
|
| E.g. 'file://path/to/public/key'
|
*/
'public' => env('JWT_PUBLIC_KEY'),
/*
|--------------------------------------------------------------------------
| Private Key
|--------------------------------------------------------------------------
|
| A path or resource to your private key.
|
| E.g. 'file://path/to/private/key'
|
*/
'private' => env('JWT_PRIVATE_KEY'),
/*
|--------------------------------------------------------------------------
| Passphrase
|--------------------------------------------------------------------------
|
| The passphrase for your private key. Can be null if none set.
|
*/
'passphrase' => env('JWT_PASSPHRASE'),
],
/*
|--------------------------------------------------------------------------
| JWT time to live
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token will be valid for.
| Defaults to 1 hour.
|
| You can also set this to null, to yield a never expiring token.
| Some people may want this behaviour for e.g. a mobile app.
| This is not particularly recommended, so make sure you have appropriate
| systems in place to revoke the token if necessary.
| Notice: If you set this to null you should remove 'exp' element from 'required_claims' list.
|
*/
'ttl' => env('JWT_TTL', 60),
/*
|--------------------------------------------------------------------------
| Refresh time to live
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token can be refreshed
| within. I.E. The user can refresh their token within a 2 week window of
| the original token being created until they must re-authenticate.
| Defaults to 2 weeks.
|
| You can also set this to null, to yield an infinite refresh time.
| Some may want this instead of never expiring tokens for e.g. a mobile app.
| This is not particularly recommended, so make sure you have appropriate
| systems in place to revoke the token if necessary.
|
*/
'refresh_ttl' => env('JWT_REFRESH_TTL', 20160),
/*
|--------------------------------------------------------------------------
| JWT hashing algorithm
|--------------------------------------------------------------------------
|
| Specify the hashing algorithm that will be used to sign the token.
|
*/
'algo' => env('JWT_ALGO', Tymon\JWTAuth\Providers\JWT\Provider::ALGO_HS256),
/*
|--------------------------------------------------------------------------
| Required Claims
|--------------------------------------------------------------------------
|
| Specify the required claims that must exist in any token.
| A TokenInvalidException will be thrown if any of these claims are not
| present in the payload.
|
*/
'required_claims' => [
'iss',
'iat',
'exp',
'nbf',
'sub',
'jti',
],
/*
|--------------------------------------------------------------------------
| Persistent Claims
|--------------------------------------------------------------------------
|
| Specify the claim keys to be persisted when refreshing a token.
| `sub` and `iat` will automatically be persisted, in
| addition to the these claims.
|
| Note: If a claim does not exist then it will be ignored.
|
*/
'persistent_claims' => [
// 'foo',
// 'bar',
],
/*
|--------------------------------------------------------------------------
| Lock Subject
|--------------------------------------------------------------------------
|
| This will determine whether a `prv` claim is automatically added to
| the token. The purpose of this is to ensure that if you have multiple
| authentication models e.g. `App\User` & `App\OtherPerson`, then we
| should prevent one authentication request from impersonating another,
| if 2 tokens happen to have the same id across the 2 different models.
|
| Under specific circumstances, you may want to disable this behaviour
| e.g. if you only have one authentication model, then you would save
| a little on token size.
|
*/
'lock_subject' => true,
/*
|--------------------------------------------------------------------------
| Leeway
|--------------------------------------------------------------------------
|
| This property gives the jwt timestamp claims some "leeway".
| Meaning that if you have any unavoidable slight clock skew on
| any of your servers then this will afford you some level of cushioning.
|
| This applies to the claims `iat`, `nbf` and `exp`.
|
| Specify in seconds - only if you know you need it.
|
*/
'leeway' => env('JWT_LEEWAY', 0),
/*
|--------------------------------------------------------------------------
| Blacklist Enabled
|--------------------------------------------------------------------------
|
| In order to invalidate tokens, you must have the blacklist enabled.
| If you do not want or need this functionality, then set this to false.
|
*/
'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
/*
| -------------------------------------------------------------------------
| Blacklist Grace Period
| -------------------------------------------------------------------------
|
| When multiple concurrent requests are made with the same JWT,
| it is possible that some of them fail, due to token regeneration
| on every request.
|
| Set grace period in seconds to prevent parallel request failure.
|
*/
'blacklist_grace_period' => env('JWT_BLACKLIST_GRACE_PERIOD', 0),
/*
|--------------------------------------------------------------------------
| Cookies encryption
|--------------------------------------------------------------------------
|
| By default Laravel encrypt cookies for security reason.
| If you decide to not decrypt cookies, you will have to configure Laravel
| to not encrypt your cookie token by adding its name into the $except
| array available in the middleware "EncryptCookies" provided by Laravel.
| see https://laravel.com/docs/master/responses#cookies-and-encryption
| for details.
|
| Set it to true if you want to decrypt cookies.
|
*/
'decrypt_cookies' => false,
/*
|--------------------------------------------------------------------------
| Providers
|--------------------------------------------------------------------------
|
| Specify the various providers used throughout the package.
|
*/
'providers' => [
/*
|--------------------------------------------------------------------------
| JWT Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to create and decode the tokens.
|
*/
'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class,
/*
|--------------------------------------------------------------------------
| Authentication Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to authenticate users.
|
*/
'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class,
/*
|--------------------------------------------------------------------------
| Storage Provider
|--------------------------------------------------------------------------
|
| Specify the provider that is used to store tokens in the blacklist.
|
*/
'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class,
],
];

View File

@ -0,0 +1,16 @@
<?php
return [
'table_prefix' => 'indonesia_',
'route' => [
'enabled' => false,
'middleware' => ['web', 'auth'],
'prefix' => 'indonesia',
],
'view' => [
'layout' => 'ui::layouts.app',
],
'menu' => [
'enabled' => false,
],
];

View File

@ -1,269 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
| The theme to use for SweetAlert2 popups.
| Available themes: dark, minimal, borderless, bootstrap-4, material-ui, wordpress-admin, bulma.
|
*/
'theme' => env('SWEET_ALERT_THEME', 'default'),
/*
|--------------------------------------------------------------------------
| CDN LINK
|--------------------------------------------------------------------------
| By default SweetAlert2 use its local sweetalert.all.js
| file.
| However, you can use its cdn if you want.
|
*/
'cdn' => env('SWEET_ALERT_CDN'),
/*
|--------------------------------------------------------------------------
| Always load the sweetalert.all.js
|--------------------------------------------------------------------------
| There might be situations where you will always want the sweet alert
| js package to be there for you. (for eg. you might use it heavily to
| show notifications or you might want to use the native js) then this
| might be handy.
|
*/
'alwaysLoadJS' => env('SWEET_ALERT_ALWAYS_LOAD_JS', false),
/*
|--------------------------------------------------------------------------
| Never load the sweetalert.all.js
|--------------------------------------------------------------------------
| If you want to handle the sweet alert js package by yourself
| (for eg. you might want to use laravel mix) then this can be
| handy.
| If you set always load js to true & never load js to false,
| it's going to prioritize the never load js.
|
| alwaysLoadJs = true & neverLoadJs = true => js will not be loaded
| alwaysLoadJs = true & neverLoadJs = false => js will be loaded
| alwaysLoadJs = false & neverLoadJs = false => js will be loaded when
| you set alert/toast by using the facade/helper functions.
*/
'neverLoadJS' => env('SWEET_ALERT_NEVER_LOAD_JS', false),
/*
|--------------------------------------------------------------------------
| AutoClose Timer
|--------------------------------------------------------------------------
|
| This is for the all Modal windows.
| For specific modal just use the autoClose() helper method.
|
*/
'timer' => env('SWEET_ALERT_TIMER', 5000),
/*
|--------------------------------------------------------------------------
| Width
|--------------------------------------------------------------------------
|
| Modal window width, including paddings (box-sizing: border-box).
| Can be in px or %.
| The default width is 32rem.
| This is for the all Modal windows.
| for particular modal just use the width() helper method.
*/
'width' => env('SWEET_ALERT_WIDTH', '32rem'),
/*
|--------------------------------------------------------------------------
| Height Auto
|--------------------------------------------------------------------------
| By default, SweetAlert2 sets html's and body's CSS height to auto !important.
| If this behavior isn't compatible with your project's layout,
| set heightAuto to false.
|
*/
'height_auto' => env('SWEET_ALERT_HEIGHT_AUTO', true),
/*
|--------------------------------------------------------------------------
| Padding
|--------------------------------------------------------------------------
|
| Modal window padding.
| Can be in px or %.
| The default padding is 1.25rem.
| This is for the all Modal windows.
| for particular modal just use the padding() helper method.
*/
'padding' => env('SWEET_ALERT_PADDING', '1.25rem'),
/*
|--------------------------------------------------------------------------
| Background
|--------------------------------------------------------------------------
|
| Modal window background
| (CSS background property).
| The default background is '#fff'.
*/
'background' => env('SWEET_ALERT_BACKGROUND', '#fff'),
/*
|--------------------------------------------------------------------------
| Animation
|--------------------------------------------------------------------------
| Custom animation with [Animate.css](https://daneden.github.io/animate.css/)
| If set to false, modal CSS animation will be use default ones.
| For specific modal just use the animation() helper method.
|
*/
'animation' => [
'enable' => env('SWEET_ALERT_ANIMATION_ENABLE', false),
],
'animatecss' => env('SWEET_ALERT_ANIMATECSS', 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css'),
/*
|--------------------------------------------------------------------------
| ShowConfirmButton
|--------------------------------------------------------------------------
| If set to false, a "Confirm"-button will not be shown.
| It can be useful when you're using custom HTML description.
| This is for the all Modal windows.
| For specific modal just use the showConfirmButton() helper method.
|
*/
'show_confirm_button' => env('SWEET_ALERT_CONFIRM_BUTTON', true),
/*
|--------------------------------------------------------------------------
| ShowCloseButton
|--------------------------------------------------------------------------
| If set to true, a "Close"-button will be shown,
| which the user can click on to dismiss the modal.
| This is for the all Modal windows.
| For specific modal just use the showCloseButton() helper method.
|
*/
'show_close_button' => env('SWEET_ALERT_CLOSE_BUTTON', false),
/*
|-----------------------------------------------------------------------
| Confirm/Cancel Button Text
|-----------------------------------------------------------------------
| Change the default text of the modal buttons.
| The texts translations will be handled by Laravel at runtime.
| This is for the all Modal windows.
| For specific modal just use the confirmButtonText() and
| cancelButtonText() helper methods.
*/
'button_text' => [
'confirm' => env('SWEET_ALERT_CONFIRM_BUTTON_TEXT', 'OK'),
'cancel' => env('SWEET_ALERT_CANCEL_BUTTON_TEXT', 'Cancel'),
],
/*
|--------------------------------------------------------------------------
| Toast position
|--------------------------------------------------------------------------
| Modal window or toast position, can be 'top',
| 'top-start', 'top-end', 'center', 'center-start',
| 'center-end', 'bottom', 'bottom-start', or 'bottom-end'.
| For specific modal just use the position() helper method.
|
*/
'toast_position' => env('SWEET_ALERT_TOAST_POSITION', 'top-end'),
/*
|--------------------------------------------------------------------------
| Progress Bar
|--------------------------------------------------------------------------
| If set to true, a progress bar at the bottom of a popup will be shown.
| It can be useful with toasts.
|
*/
'timer_progress_bar' => env('SWEET_ALERT_TIMER_PROGRESS_BAR', false),
/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
| Modal window or toast, config for the Middleware
|
*/
'middleware' => [
'autoClose' => env('SWEET_ALERT_MIDDLEWARE_AUTO_CLOSE', false),
'toast_position' => env('SWEET_ALERT_MIDDLEWARE_TOAST_POSITION', 'top-end'),
'toast_close_button' => env('SWEET_ALERT_MIDDLEWARE_TOAST_CLOSE_BUTTON', true),
'timer' => env('SWEET_ALERT_MIDDLEWARE_ALERT_CLOSE_TIME', 6000),
'auto_display_error_messages' => env('SWEET_ALERT_AUTO_DISPLAY_ERROR_MESSAGES', true),
],
/*
|--------------------------------------------------------------------------
| Custom Class
|--------------------------------------------------------------------------
| A custom CSS class for the modal:
|
*/
'customClass' => [
'container' => env('SWEET_ALERT_CONTAINER_CLASS'),
'popup' => env('SWEET_ALERT_POPUP_CLASS'),
'header' => env('SWEET_ALERT_HEADER_CLASS'),
'title' => env('SWEET_ALERT_TITLE_CLASS'),
'closeButton' => env('SWEET_ALERT_CLOSE_BUTTON_CLASS'),
'icon' => env('SWEET_ALERT_ICON_CLASS'),
'image' => env('SWEET_ALERT_IMAGE_CLASS'),
'content' => env('SWEET_ALERT_CONTENT_CLASS'),
'input' => env('SWEET_ALERT_INPUT_CLASS'),
'actions' => env('SWEET_ALERT_ACTIONS_CLASS'),
'confirmButton' => env('SWEET_ALERT_CONFIRM_BUTTON_CLASS'),
'cancelButton' => env('SWEET_ALERT_CANCEL_BUTTON_CLASS'),
'footer' => env('SWEET_ALERT_FOOTER_CLASS'),
],
/*
|--------------------------------------------------------------------------
| confirmDelete
|--------------------------------------------------------------------------
| customize the configuration options of the confirmation popup.
|
*/
'confirm_delete_confirm_button_text' => env('SWEET_ALERT_CONFIRM_DELETE_CONFIRM_BUTTON_TEXT', 'Yes, delete it!'),
'confirm_delete_confirm_button_color' => env('SWEET_ALERT_CONFIRM_DELETE_CONFIRM_BUTTON_COLOR'),
'confirm_delete_cancel_button_color' => env('SWEET_ALERT_CONFIRM_DELETE_CANCEL_BUTTON_COLOR', '#d33'),
'confirm_delete_cancel_button_text' => env('SWEET_ALERT_CONFIRM_DELETE_CANCEL_BUTTON_TEXT', 'Cancel'),
'confirm_delete_show_cancel_button' => env('SWEET_ALERT_CONFIRM_DELETE_SHOW_CANCEL_BUTTON', true),
'confirm_delete_show_close_button' => env('SWEET_ALERT_CONFIRM_DELETE_SHOW_CLOSE_BUTTON', false),
'confirm_delete_icon' => env('SWEET_ALERT_CONFIRM_DELETE_ICON', 'warning'),
'confirm_delete_show_loader_on_confirm' => env('SWEET_ALERT_CONFIRM_DELETE_SHOW_LOADER_ON_CONFIRM', true),
];

50
config/tinker.php Normal file
View File

@ -0,0 +1,50 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Console Commands
|--------------------------------------------------------------------------
|
| This option allows you to add additional Artisan commands that should
| be available within the Tinker environment. Once the command is in
| this array you may execute the command in Tinker using its name.
|
*/
'commands' => [
// App\Console\Commands\ExampleCommand::class,
],
/*
|--------------------------------------------------------------------------
| Auto Aliased Classes
|--------------------------------------------------------------------------
|
| Tinker will not automatically alias classes in your vendor namespaces
| but you may explicitly allow a subset of classes to get aliased by
| adding the names of each of those classes to the following list.
|
*/
'alias' => [
//
],
/*
|--------------------------------------------------------------------------
| Classes That Should Not Be Aliased
|--------------------------------------------------------------------------
|
| Typically, Tinker automatically aliases classes as you require them in
| Tinker. However, you may wish to never alias certain classes, which
| you may accomplish by listing the classes in the following array.
|
*/
'dont_alias' => [
'App\Nova',
],
];

View File

@ -1,23 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\payment>
*/
class PaymentFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Refund>
*/
class RefundFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\RefundUser>
*/
class RefundUserFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\transaction>
*/
class TransactionFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}

View File

@ -18,11 +18,22 @@ class UserFactory extends Factory
public function definition(): array
{
return [
'name' => fake()->name(),
'id' => Str::uuid(),
'nama_depan' => $this->faker->firstName,
'nama_belakang' => $this->faker->lastName,
'tanggal_lahir' => $this->faker->date($format = 'Y-m-d', $max = 'now'),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
'role' => 'User',
'nik' => $this->faker->nik($this->faker->randomElement(['male', 'female']),$this->faker->dateTimeBetween('-65 years', '-18 years')),
'alamat'=> $this->faker->address,
'nohp'=> $this->faker->phoneNumber(),
'persentase_kemiripan' => random_int(0, 100).'%',
'status'=> $this->faker->randomElement(['Progress', 'Finished', 'Rejected']),
'gender' => $this->faker->randomElement(['Laki-laki', 'Perempuan']),
'kode_kelurahan' => '1101012002',
];
}

View File

@ -12,13 +12,28 @@ return new class extends Migration
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->uuid('id')->primary;
$table->string('nama_depan',255);
$table->string('nama_belakang',255);
$table->date('tanggal_lahir');
$table->string('email',50)->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->enum('role',['Admin','User'])->default('User');
$table->string('nohp',20);
$table->string('nik',20);
$table->string('alamat',255);
$table->string('foto_ktp')->nullable();
$table->string('foto_wajah')->nullable();
$table->string('foto_profil')->nullable();
$table->string('persentase_kemiripan')->nullable();
$table->enum('status',['Finished','Progress','Rejected'])->default('Progress');
$table->string('gender',15);
$table->char('kode_kelurahan',10);
$table->rememberToken();
$table->timestamps();
// $table->foreign('kode_kelurahan')->on('villages')->references('code');
});
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateProvincesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(config('laravolt.indonesia.table_prefix').'provinces', function (Blueprint $table) {
$table->bigIncrements('id');
$table->char('code', 2)->unique();
$table->string('name', 255);
$table->text('meta')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop(config('laravolt.indonesia.table_prefix').'provinces');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCitiesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(config('laravolt.indonesia.table_prefix').'cities', function (Blueprint $table) {
$table->bigIncrements('id');
$table->char('code', 4)->unique();
$table->char('province_code', 2);
$table->string('name', 255);
$table->text('meta')->nullable();
$table->timestamps();
$table->foreign('province_code')
->references('code')
->on(config('laravolt.indonesia.table_prefix').'provinces')
->onUpdate('cascade')->onDelete('restrict');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop(config('laravolt.indonesia.table_prefix').'cities');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDistrictsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(config('laravolt.indonesia.table_prefix').'districts', function (Blueprint $table) {
$table->bigIncrements('id');
$table->char('code', 7)->unique();
$table->char('city_code', 4);
$table->string('name', 255);
$table->text('meta')->nullable();
$table->timestamps();
$table->foreign('city_code')
->references('code')
->on(config('laravolt.indonesia.table_prefix').'cities')
->onUpdate('cascade')->onDelete('restrict');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop(config('laravolt.indonesia.table_prefix').'districts');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateVillagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(config('laravolt.indonesia.table_prefix').'villages', function (Blueprint $table) {
$table->bigIncrements('id');
$table->char('code', 10)->unique();
$table->char('district_code', 7);
$table->string('name', 255);
$table->text('meta')->nullable();
$table->timestamps();
$table->foreign('district_code')
->references('code')
->on(config('laravolt.indonesia.table_prefix').'districts')
->onUpdate('cascade')->onDelete('restrict');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop(config('laravolt.indonesia.table_prefix').'villages');
}
}

View File

@ -0,0 +1,55 @@
<?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('transactions', function (Blueprint $table) {
$table->uuid('id')->primary(); //order_id
$table->string('pembeli'); // untuk customer_details
$table->string('penjual'); //merchant_name
$table->string('nama_barang'); // item_details -> item_name
$table->string('deskripsi_transaksi')->nullable();
$table->string('satuan_barang');
$table->double('harga_barang'); // harga sebelum penambahan
$table->double('jumlah_barang');
$table->double('persentase_keuntungan'); // persentase keuntungan
$table->double('total_keuntungan'); // perolehan keuntungan
$table->double('total_harga'); // gross amount
$table->double('total_bayar');
$table->string('signature_key')->nullable();
$table->string('token');
$table->string('metode_pembayaran')->nullable();
$table->string('acquire')->nullable();
$table->string('issuer')->nullable();
$table->char('currency',3)->nullable();
$table->string('fraud_status')->nullable();
$table->string('merchant_id')->nullable();
$table->string('status_code')->nullable();
$table->string('tipe_transaction')->nullable();
$table->enum('status',['settlement','capture','pending','cancel','refund','expire','failure','progress','failed','sending','sended','finished'])->default('pending'); // transaction_status
$table->timestamp('batas_pembayaran');
$table->timestamp('batas_pengiriman_barang_awal');
$table->timestamp('batas_pengiriman_barang_akhir');
$table->timestamp('tanggal_pembayaran')->nullable();
$table->timestamps();
$table->foreign('pembeli')->on('users')->references('email');
$table->foreign('penjual')->on('users')->references('email');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('transactions');
}
};

View File

@ -1,27 +0,0 @@
<?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('transactions', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('transactions');
}
};

View File

@ -1,27 +0,0 @@
<?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('refunds', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('refunds');
}
};

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('refunds', function (Blueprint $table) {
$table->id();
$table->foreignUuid('order_id');
$table->double('total',10);
$table->timestamp('due_date');
$table->enum('status',['partial refund','deny','pending'])->default('Pending');
$table->timestamps();
$table->foreign('order_id')->on('transactions')->references('id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('refunds');
}
};

View File

@ -1,27 +0,0 @@
<?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('refund_users', function (Blueprint $table) {
$table->id();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('refund_users');
}
};

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('bulan',20);
$table->string('tahun',5);
$table->integer('persentase');
$table->enum('status',['Active', 'Nonactive']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('settings');
}
};

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('contacts', function (Blueprint $table) {
$table->id();
$table->string('pemilik_kontak');
$table->string('relasi_kontak');
$table->foreign('pemilik_kontak')->on('users')->references('email');
$table->foreign('relasi_kontak')->on('users')->references('email');
$table->unique(['pemilik_kontak','relasi_kontak']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('contacts');
}
};

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('transaction_descriptions', function (Blueprint $table) {
$table->id();
$table->foreignUuid('order_id');
$table->string('status',15);
$table->string('user');
$table->string('background');
$table->string('judul');
$table->string('deskripsi');
$table->timestamps();
$table->foreign('order_id')->on('transactions')->references('id');
$table->foreign('user')->on('users')->references('email');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('transaction_descriptions');
}
};

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('refund_descriptions', function (Blueprint $table) {
$table->id();
$table->foreignId('refund_id');
$table->string('filename');
$table->string('type');
$table->timestamps();
$table->foreign('refund_id')->on('refunds')->references('id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('refund_descriptions');
}
};

View File

@ -1,38 +0,0 @@
<?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('payments', function (Blueprint $table) {
$table->id();
$table->string('status');
$table->string('email');
$table->string('nominal');
$table->string('tujuan');
$table->string('deskripsi');
$table->string('transaction_id');
$table->string('order_id');
$table->string('gross_amount');
$table->string('payment_type');
$table->string('payment_code')->nullable();
$table->string('pdf_url')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('payments');
}
};

View File

@ -4,6 +4,16 @@ namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\User;
use Carbon\Carbon;
use App\Models\Setting;
use Illuminate\Support\Str;
use Faker\Factory as FakerFactory;
use Faker\Provider\id_ID\Person as Person;
use Laravolt\Indonesia\Seeds\CitiesSeeder;
use Laravolt\Indonesia\Seeds\VillagesSeeder;
use Laravolt\Indonesia\Seeds\DistrictsSeeder;
use Laravolt\Indonesia\Seeds\ProvincesSeeder;
class DatabaseSeeder extends Seeder
{
@ -12,11 +22,39 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
// \App\Models\User::factory(10)->create();
$faker = FakerFactory::create();
$faker->addProvider(new Person($faker));
// \App\Models\User::factory()->create([
// 'name' => 'Test User',
// 'email' => 'test@example.com',
// ]);
User::factory()->create([
'id' => Str::uuid(),
'nama_depan' => $faker->firstName,
'nama_belakang' => $faker->lastName,
'tanggal_lahir' => $faker->date($format = 'Y-m-d', $max = 'now'),
'email' => 'admin@example.net',
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
'role' => 'Admin',
'nik' => $faker->nik($faker->randomElement(['male', 'female']), $faker->dateTimeBetween('-65 years', '-18 years')),
'alamat' => $faker->address,
'nohp' => $faker->phoneNumber(),
'status' => 'Finished',
'persentase_kemiripan' => '100%',
'gender' => $faker->randomElement(['Laki-laki', 'Perempuan']),
'kode_kelurahan' => '1101012002',
]);
User::factory(20)->create();
$now = Carbon::now()->tz('Asia/Jakarta');
$bulan = $now->format('F');
$tahun = $now->year;
Setting::create([
'bulan' => $bulan,
'tahun' => $tahun,
'persentase' => 5,
'status' => 'Active'
]);
$this->call([ProvincesSeeder::class, CitiesSeeder::class, DistrictsSeeder::class, VillagesSeeder::class]);
}
}

View File

@ -1,17 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class PaymentSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@ -1,17 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class RefundSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@ -1,17 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class RefundUserSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@ -1,17 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class TransactionSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

59
docker/8.0/Dockerfile Normal file
View File

@ -0,0 +1,59 @@
FROM ubuntu:20.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=16
ARG POSTGRES_VERSION=13
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.0-cli php8.0-dev \
php8.0-pgsql php8.0-sqlite3 php8.0-gd php8.0-imagick \
php8.0-curl php8.0-memcached \
php8.0-imap php8.0-mysql php8.0-mbstring \
php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap \
php8.0-intl php8.0-readline php8.0-pcov \
php8.0-msgpack php8.0-igbinary php8.0-ldap \
php8.0-redis php8.0-swoole php8.0-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN update-alternatives --set php /usr/bin/php8.0
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.0
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.0/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/8.0/php.ini Normal file
View File

@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

58
docker/8.1/Dockerfile Normal file
View File

@ -0,0 +1,58 @@
FROM ubuntu:22.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=18
ARG POSTGRES_VERSION=15
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.1-cli php8.1-dev \
php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-imagick \
php8.1-curl \
php8.1-imap php8.1-mysql php8.1-mbstring \
php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap \
php8.1-intl php8.1-readline \
php8.1-ldap \
php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole \
php8.1-memcached php8.1-pcov php8.1-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.1
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/8.1/php.ini Normal file
View File

@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

59
docker/8.2/Dockerfile Normal file
View File

@ -0,0 +1,59 @@
FROM ubuntu:22.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=18
ARG POSTGRES_VERSION=15
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils librsvg2-bin fswatch \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.2-cli php8.2-dev \
php8.2-pgsql php8.2-sqlite3 php8.2-gd php8.2-imagick \
php8.2-curl \
php8.2-imap php8.2-mysql php8.2-mbstring \
php8.2-xml php8.2-zip php8.2-bcmath php8.2-soap \
php8.2-intl php8.2-readline \
php8.2-ldap \
php8.2-msgpack php8.2-igbinary php8.2-redis php8.2-swoole \
php8.2-memcached php8.2-pcov php8.2-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& npm install -g pnpm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.2
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.2/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/8.2/php.ini Normal file
View File

@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
mysql --user=root --password="$MYSQL_ROOT_PASSWORD" <<-EOSQL
CREATE DATABASE IF NOT EXISTS testing;
GRANT ALL PRIVILEGES ON \`testing%\`.* TO '$MYSQL_USER'@'%';
EOSQL

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