Upload Project

This commit is contained in:
Akbar Kusnadi ( Akkusna ) 2024-07-25 13:36:30 +07:00
parent 4dc948558d
commit 75af6f0205
6911 changed files with 669255 additions and 24 deletions

18
.editorconfig Normal file
View File

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

58
.env.example Normal file
View File

@ -0,0 +1,58 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

11
.gitattributes vendored Normal file
View File

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

39
.gitignore vendored
View File

@ -1,25 +1,18 @@
# ---> Laravel /.phpunit.cache
/vendor/ /node_modules
node_modules/ /public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
Homestead.json
Homestead.yaml
auth.json
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
/.fleet
# Laravel 4 specific /.idea
bootstrap/compiled.php /.vscode
app/storage/
# Laravel 5 & Lumen specific
public/storage
public/hot
# Laravel 5 & Lumen specific with changed public path
public_html/storage
public_html/hot
storage/*.key
.env
Homestead.yaml
Homestead.json
/.vagrant
.phpunit.result.cache

View File

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

27
app/Console/Kernel.php Normal file
View File

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

View File

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

View File

@ -0,0 +1,64 @@
<?php
namespace App\Exports;
use App\Models\BahanBaku;
use Carbon\Carbon;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
class BahanBakuExport implements FromCollection, WithHeadings, WithMapping
{
protected $startDate;
protected $endDate;
public function __construct($startDate, $endDate)
{
$this->startDate = $startDate;
$this->endDate = $endDate;
}
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return BahanBaku::with(['transaksiMasuk', 'transaksiKeluar'])
->when($this->startDate, function ($query) {
$query->whereDate('created_at', '>=', $this->startDate);
})
->when($this->endDate, function ($query) {
$query->whereDate('created_at', '<=', $this->endDate);
})
->get();
}
public function headings(): array
{
return [
'No',
'Bahan Baku',
'Harga per meter',
'Jumlah Masuk',
'Total Harga',
'Jumlah Digunakan',
'Sisa Bahan',
'Tanggal Beli',
];
}
public function map($bahan): array
{
return [
$bahan->id,
$bahan->nama,
'Rp. ' . number_format($bahan->harga, 0, ',', '.'),
$bahan->transaksiMasuk->sum('qty') . ' meter',
'Rp. ' . number_format($bahan->harga * $bahan->transaksiMasuk->sum('qty'), 0, ',', '.'),
$bahan->transaksiKeluar->sum('qty') . ' meter',
$bahan->qty,
Carbon::parse($bahan->created_at)->format('d F Y'),
];
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Exports;
use App\Models\Order;
use App\Models\Pesanan;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
class OrdersExport implements FromCollection, WithHeadings, WithMapping
{
protected $startDate;
protected $endDate;
public function __construct($startDate, $endDate)
{
$this->startDate = $startDate;
$this->endDate = $endDate;
}
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return Pesanan::with(['user', 'produk', 'detailPesanan.color', 'detailPesanan.ukuran'])
->when($this->startDate, function ($query) {
$query->whereDate('created_at', '>=', $this->startDate);
})
->when($this->endDate, function ($query) {
$query->whereDate('created_at', '<=', $this->endDate);
})
->get();
}
public function headings(): array
{
return [
'No',
'Nama Pelanggan',
'Pesanan',
'Detail Pesanan',
'Total Harga',
'Tanggal Pesan',
];
}
public function map($order): array
{
$details = $order->detailPesanan->map(function ($detail) {
return "{$detail->color->name_color} / {$detail->ukuran->ukuran} x {$detail->qty}";
})->implode("\n");
return [
$order->id,
$order->user->name,
"{$order->produk->nama} x {$order->qty}",
$details,
'Rp. ' . number_format($order->produk->harga * $order->qty, 0, ',', '.'),
\Carbon\Carbon::parse($order->created_at)->format('d F Y'),
];
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace App\Http\Controllers;
use App\Exports\BahanBakuExport;
use App\Models\BahanBaku;
use App\Models\TransaksiKeluar;
use App\Models\TransaksiMasuk;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
class BahanBakuController extends Controller
{
public function index()
{
$bahan = BahanBaku::OrderByDesc('id')->get();
$bahanMasuk = TransaksiMasuk::OrderByDesc('id')->with('bahanBaku')->get();
$bahanKeluar = TransaksiKeluar::OrderByDesc('id')->with(['bahanBaku', 'pesanan'])->get();
return view('dashboard.bahan', compact('bahan', 'bahanMasuk', 'bahanKeluar'));
}
public function store(Request $request)
{
$validatedData = $request->validate([
'nama' => 'required',
'harga' => 'required',
'qty' => 'required',
]);
$bahan = BahanBaku::create([
'nama' => $validatedData['nama'],
'harga' => $validatedData['harga'],
'qty' => $validatedData['qty'],
'total_harga' => $validatedData['harga'] * $validatedData['qty']
]);
if ($bahan) {
TransaksiMasuk::create([
'bahan_baku_id' => $bahan->id,
'qty' => $validatedData['qty'],
]);
return redirect()->route('bahan')->with('message', 'Data Berhasil Ditambahkan');
} else {
return back()->withInput()->with('error', 'Gagal menambahkan data');
}
}
public function laporan_bahan()
{
$bahan = BahanBaku::with(['transaksiMasuk', 'transaksiKeluar'])->get();
return view('dashboard.laporan-bahan', compact('bahan'));
}
public function exportBahanExcel(Request $request)
{
$startDate = $request->query('start_date');
$endDate = $request->query('end_date');
return Excel::download(new BahanBakuExport($startDate, $endDate), 'bahan_baku.xlsx');
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace App\Http\Controllers;
use App\Models\Bank;
use Illuminate\Http\Request;
class BankController extends Controller
{
public function index()
{
$bank = Bank::OrderByDesc('id')->get();
return view('dashboard.bank', compact('bank'));
}
public function store(Request $request)
{
$validatedData = $request->validate([
'nama' => 'required',
'no_rekening' => 'required',
]);
Bank::create($validatedData);
return redirect()->route('bank')->with('message', 'Data berhasil disimpan.');
}
public function delete($id)
{
$bank = Bank::findOrFail($id);
$bank->delete();
return redirect()->route('bank')->with('message', 'Data berhasil dihapus.');
}
public function update(Request $request, $id)
{
$validatedData = $request->validate([
'nama' => 'required',
'no_rekening' => 'required',
]);
$bank = Bank::findOrFail($id);
$bank->update($validatedData);
return redirect()->route('bank')->with('message', 'Data berhasil diperbarui.');
}
}

View File

@ -0,0 +1,91 @@
<?php
namespace App\Http\Controllers;
use App\Models\Bank;
use App\Models\DetailPesanan;
use App\Models\DetailProduk;
use App\Models\Pengiriman;
use App\Models\Pesanan;
use App\Models\PesananColor;
use App\Models\PesananUkuran;
use App\Models\Produk;
use App\Models\ProdukColor;
use App\Models\ProdukUkuran;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class CheckoutController extends Controller
{
public function index($id, Request $request)
{
$bank = Bank::all();
$produk = Produk::with('kategori')->findOrFail($id);
$warna = ProdukColor::where('produk_id', $id)->with('color')->get();
$ukuran = ProdukUkuran::where('produk_id', $id)->with('ukuran')->get();
$userId = Auth::id();
$pengiriman = Pengiriman::whereHas('pesanan', function ($query) use ($userId) {
$query->where('user_id', $userId);
})->get();
$lengan = $produk->lengan;
return view('landing.checkout', compact('produk', 'bank', 'warna', 'ukuran', 'pengiriman', 'lengan'));
}
public function store_pesanan(Request $request)
{
$request->validate([
'color_id' => 'required|array',
'produk_id' => 'required',
'ukuran_id' => 'required|array',
'qty' => 'required|array',
'ukuran_lengan' => 'nullable|array',
'qty.*' => 'required|numeric|min:1',
'pengiriman' => 'required',
'grand_total' => 'required',
'bukti' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
'detail_pesanan' => 'required',
'detail_alamat' => 'required',
], [
'bukti.required' => 'Anda harus mengunggah gambar.',
'bukti.image' => 'File harus berupa gambar.',
'bukti.mimes' => 'Gambar harus dalam format JPEG, PNG, JPG, atau GIF.',
'bukti.max' => 'Ukuran gambar tidak boleh lebih dari 2MB.',
]);
$fileNameImage = time() . '.' . $request->bukti->extension();
$request->bukti->move(public_path('foto/bukti/'), $fileNameImage);
$totalQty = array_sum($request->qty);
$pesanan = Pesanan::create([
'user_id' => auth()->user()->id,
'produk_id' => $request->produk_id,
'qty' => $totalQty,
'grand_total' => $request->grand_total,
'status' => "menunggu konfirmasi",
'bukti' => $fileNameImage,
'pengiriman' => $request->pengiriman,
'status_pembayaran' => "belum_bayar",
'detail_pesanan' => $request->detail_pesanan,
'detail_alamat' => $request->detail_alamat,
]);
foreach ($request->color_id as $key => $color_id) {
DetailPesanan::create([
'pesanan_id' => $pesanan->id,
'color_id' => $color_id,
'ukuran_id' => $request->ukuran_id[$key],
'ukuran_lengan' => $request->ukuran_lengan[$key] ?? null,
'qty' => $request->qty[$key],
]);
}
if ($request->pengiriman === 'pengiriman') {
$pesanan->pengiriman_id = $request->pengiriman_id;
} else {
$pesanan->pengiriman_id = null;
}
$pesanan->save();
return redirect()->route('dashboard-user')->with('message', 'Berhasil melakukan pemesanan.');
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace App\Http\Controllers;
use App\Models\Color;
use Illuminate\Http\Request;
class ColorController extends Controller
{
public function index()
{
$colors = Color::OrderByDesc('id')->get();
return view('dashboard.colors', compact('colors'));
}
public function store(Request $request)
{
$validatedData = $request->validate([
'name_color' => 'required',
'code_color' => 'required',
]);
Color::create($validatedData);
return redirect()->route('colors')->with('message', 'Data berhasil disimpan.');
}
public function delete($id)
{
$color = Color::findOrFail($id);
$color->delete();
return redirect()->route('colors')->with('message', 'Data berhasil dihapus.');
}
public function update(Request $request, $id)
{
$validatedData = $request->validate([
'name_color' => 'required',
'code_color' => 'required',
]);
$color = Color::findOrFail($id);
$color->update($validatedData);
return redirect()->route('colors')->with('message', 'Data berhasil diperbarui.');
}
}

View File

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

View File

@ -0,0 +1,103 @@
<?php
namespace App\Http\Controllers;
use App\Models\Pengiriman;
use App\Models\Pesanan;
use App\Models\Produk;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class DashboardController extends Controller
{
public function index()
{
$user = User::where('is_admin', '0')->count();
$produk = Produk::count();
$pesanan = Pesanan::count();
$pengiriman = Pengiriman::count();
$userLatest = User::OrderByDesc('id')->where('is_admin', '0')->take(5)->get();
$pesananLatest = Pesanan::with('user')->OrderByDesc('id')->take(5)->get();
return view('dashboard.dashboard', compact('user', 'produk', 'pesanan', 'pengiriman', 'userLatest', 'pesananLatest'));
}
public function index_user()
{
$user = auth()->user()->id;
$pesanan = Pesanan::where('user_id', $user)->where('status', 'proses')->count();
$pesananFinish = Pesanan::where('user_id', $user)->where('status', 'selesai')->count();
$pengiriman = Pesanan::where('user_id', $user)
->where('status', 'dalam pengiriman')
->whereNotNull('pengiriman_id')
->count();
$pengirimanFinish = Pesanan::where('user_id', $user)
->where('status', 'selesai')
->whereNotNull('pengiriman_id')
->count();
return view('dashboard.user.home', compact('pesanan', 'pesananFinish', 'pengiriman', 'pengirimanFinish'));
}
public function pesanan_user()
{
$idUser = Auth::user()->id;
$pesanan = Pesanan::with(['user', 'detailPesanan.color', 'produk'])
->where('user_id', $idUser)
->orderByDesc('id')
->get();
return view('dashboard.user.pesanan', compact('pesanan'));
}
public function pengiriman_user()
{
$idUser = Auth::user()->id;
$pesanan = Pesanan::where('user_id', $idUser)
->where('pengiriman_id', '!=', null)
// ->where('status', 'dalam pengiriman')
->get();
return view('dashboard.user.pengiriman', compact('pesanan'));
}
public function update_pengiriman_user($id)
{
$pengiriman = Pesanan::findOrFail($id);
$pengiriman->update([
'status' => 'selesai'
]);
return redirect()->back()->with('message', 'Paket telah diterima');
}
public function update_pelunasan(Request $request, $id)
{
$pesanan = Pesanan::findOrFail($id);
$request->validate([
'bukti_pelunasan' => 'image|mimes:jpeg,png,jpg,gif|max:2048',
]);
$fileNameImage = time() . '.' . $request->bukti_pelunasan->extension();
$request->bukti_pelunasan->move(public_path('foto/bukti/'), $fileNameImage);
$pesanan->update([
'bukti_pelunasan' => $fileNameImage
]);
return redirect()->back()->with('message', 'Berhasil upload bukti pelunasan');
}
public function profile_admin()
{
return view('dashboard.profile');
}
public function profile_user()
{
return view('dashboard.user.profile');
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class DetailPesananController extends Controller
{
//
}

View File

@ -0,0 +1,54 @@
<?php
namespace App\Http\Controllers;
use App\Models\Kategori;
use Illuminate\Http\Request;
class KategoriController extends Controller
{
public function index()
{
$kategori = Kategori::OrderByDesc('id')->get();
return view('dashboard.kategori', compact('kategori'));
}
public function store(Request $request)
{
$validatedData = $request->validate([
'nama' => 'required',
]);
Kategori::create($validatedData);
return redirect()->route('kategori')->with('message', 'Data berhasil disimpan.');
}
public function delete($id)
{
$kategori = Kategori::findOrFail($id);
$kategori->delete();
return redirect()->route('kategori')->with('message', 'Data berhasil dihapus.');
}
public function update(Request $request, $id)
{
$validatedData = $request->validate([
'nama' => 'required',
]);
$kategori = Kategori::findOrFail($id);
$kategori->update($validatedData);
return redirect()->route('kategori')->with('message', 'Data berhasil diperbarui.');
}
public function produkByKategori($id)
{
$kategori = Kategori::findOrFail($id);
$produk = $kategori->produk()->get();
return view('landing.produk-list', compact('produk'));
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\Http\Controllers;
use App\Models\Kategori;
use App\Models\Produk;
use Illuminate\Http\Request;
class LandingController extends Controller
{
public function index()
{
$kategori = Kategori::withTotalProduk()->get();
$latestProduk = Produk::latest()->take(6)->get();
return view('landing.home', compact('kategori', 'latestProduk'));
}
public function shop()
{
$produk = Produk::orderByDesc('id')->with('kategori')->paginate(9);
return view('landing.shop', compact('produk'));
}
public function searchProduk(Request $request)
{
if ($request->ajax()) {
$query = $request->get('query');
$produk = Produk::where('nama', 'like', '%' . $query . '%')->paginate(9);
return response()->json($produk);
}
}
public function category()
{
$kategori = Kategori::all();
$produk = Produk::orderByDesc('id')->with('kategori')->paginate(9);
return view('landing.kategori', compact('produk', 'kategori'));
}
public function getProdukByKategori($kategori_id)
{
$produk = Produk::where('kategori_id', $kategori_id)->get();
return response()->json($produk);
}
public function contact()
{
return view('landing.contact');
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
class LoginController extends Controller
{
public function index()
{
return view('auth.login');
}
public function login(Request $request)
{
$messages = [
'email.required' => 'Email wajib diisi.',
'email.email' => 'Email tidak valid.',
'password.required' => 'Password wajib diisi.',
'password.min' => 'Password harus minimal 8 karakter.'
];
$validator = Validator::make($request->all(), [
'email' => 'required|email',
'password' => 'required|min:8'
], $messages);
$validator->validate();
$email = $request->input('email');
$password = $request->input('password');
$remember = $request->boolean('remember');
if (!Auth::attempt(['email' => $email, 'password' => $password], $remember)) {
$user = \App\Models\User::where('email', $email)->first();
if (!$user) {
throw ValidationException::withMessages([
'email' => 'Email tidak terdaftar.'
]);
} else {
throw ValidationException::withMessages([
'password' => 'Password salah.'
]);
}
}
$request->session()->regenerate();
$user = Auth::user();
if ($user->is_admin == 1) {
return redirect()->route('dashboard')->with('message', 'Berhasil Login');
} else {
return redirect()->route('home')->with('message', 'Berhasil Login');
}
}
public function logout(Request $request)
{
Auth::guard('web')->logout();
$request->session()->invalidate();
return redirect('/');
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace App\Http\Controllers;
use App\Mail\SomeMailableClass;
use App\Models\PasswordReset;
use App\Models\User;
use Illuminate\Auth\Notifications\ResetPassword;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Str;
class LupaPasswordController extends Controller
{
public function index()
{
return view('auth.forgot-password');
}
public function sendEmail(Request $request)
{
$request->validate(['email' => 'required|email|exists:users,email']);
$user = User::where('email', $request->email)->firstOrFail();
$randomString = Str::random(40);
PasswordReset::updateOrCreate(
['email' => $request->email],
['token' => $randomString, 'created_at' => now()]
);
Mail::to($request->email)->send(new SomeMailableClass($randomString));
return redirect()->back()->with('message', 'Berhasil mengirim link reset password ke email anda.');
}
public function validasi_forgot_password(Request $request, $token)
{
$getToken = PasswordReset::where('token', $token)->first();
if (!$getToken) {
return redirect()->route('login')->with('error', 'Token tidak valid');
}
return view('auth.validasi-password', compact('token'));
}
public function validasi_forgot_password_act(Request $request)
{
$request->validate([
'password' => 'required|min:8'
]);
$token = PasswordReset::where('token', $request->token)->first();
if (!$token) {
return redirect()->route('login')->with('error', 'Token tidak valid');
}
$user = User::where('email', $token->email)->first();
if (!$user) {
return redirect()->route('login')->with('failed', 'Email tidak terdaftar di database');
}
$user->update([
'password' => Hash::make($request->password)
]);
$token->delete();
return redirect()->route('login')->with('message', 'Password berhasil direset');
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class NotaController extends Controller
{
public function index()
{
return view('dashboard.nota');
}
}

View File

@ -0,0 +1,89 @@
<?php
namespace App\Http\Controllers;
use App\Models\Pengiriman;
use App\Models\Pesanan;
use Illuminate\Http\Request;
class PengirimanController extends Controller
{
public function index()
{
$pengiriman = Pengiriman::with('pesanan')->OrderByDesc('id')->get();
return view('dashboard.pengiriman', compact('pengiriman'));
}
public function indexPengirimanPesanan()
{
$pengiriman = Pengiriman::with(['pesanan', 'pesanan.user', 'pesanan.produk'])->OrderByDesc('id')->get();
$pesanan_user = Pesanan::with(['user', 'produk'])
->where('status_pembayaran', 'lunas')
->where('status', 'proses')
->where('pengiriman', 'pengiriman')
->where('pengiriman_id', null)
->get();
return view('dashboard.pesanan_pengiriman', compact('pengiriman', 'pesanan_user'));
}
public function store(Request $request)
{
$validateData = $request->validate([
'tanggal_pengiriman' => 'required',
'estimasi' => 'required',
'tanggal_tiba' => 'required',
'alamat' => 'required',
'alamat_tujuan' => 'required',
'jasa_ekspedisi' => 'required',
'harga_ongkir' => 'required',
]);
Pengiriman::create($validateData);
return redirect()->route('pengiriman')->with('message', 'Data berhasil ditambah');
}
public function update(Request $request, $id)
{
$pengiriman = Pengiriman::findOrFail($id);
$validateData = $request->validate([
'tanggal_pengiriman' => 'required',
'estimasi' => 'required',
'tanggal_tiba' => 'required',
'alamat' => 'required',
'alamat_tujuan' => 'required',
'jasa_ekspedisi' => 'required',
'harga_ongkir' => 'required',
]);
$pengiriman->update($validateData);
return redirect()->route('pengiriman')->with('message', 'Data berhasil diupdate');
}
public function updatePesanan(Request $request)
{
$request->validate([
'pengiriman_id' => 'required',
'pesanan_id' => 'required'
]);
$pesanan = Pesanan::findOrFail($request->pesanan_id);
$pesanan->update([
'status' => "dalam pengiriman",
'pengiriman_id' => $request->pengiriman_id,
]);
return redirect()->route('pengiriman.pesanan')->with('message', 'Barang berhasil dikirim');
}
public function delete($id)
{
$pengiriman = Pengiriman::findOrFail($id);
$pengiriman->delete();
return redirect()->route('pengiriman')->with('message', 'Data berhasil dihapus.');
}
}

View File

@ -0,0 +1,169 @@
<?php
namespace App\Http\Controllers;
use App\Exports\OrdersExport;
use App\Models\Pesanan;
use App\Models\BahanBaku;
use App\Models\DetailPesanan;
use App\Models\PesananBahanBaku;
use App\Models\TransaksiKeluar;
use Illuminate\Http\Request;
use Barryvdh\DomPDF\Facade\Pdf as FacadePdf;
use Carbon\Carbon;
use Endroid\QrCode\QrCode as QrCodeQrCode;
use Endroid\QrCode\Writer\PngWriter;
use Maatwebsite\Excel\Facades\Excel;
class PesananController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$pesanan = Pesanan::with(['user', 'detailPesanan.color', 'detailPesanan.ukuran', 'produk', 'detailPesananBahanBaku'])->orderByDesc('id')->get();
$bahan = BahanBaku::all();
return view('dashboard.pemesanan', compact('pesanan', 'bahan'));
}
public function update(Request $request, $id)
{
$request->validate([
'status' => 'required',
'status_pembayaran' => 'required',
]);
$pesanan = Pesanan::findOrFail($id);
if ($pesanan->status === 'selesai') {
return back()->withErrors('Pesanan telah selesai tidak dapat melakukan perubahan');
}
if ($pesanan->status === 'lunas') {
return back()->withErrors('Pesanan telah dibayar lunas tidak dapat melakukan perubahan');
}
$pesanan->update([
'status' => $request->status,
'status_pembayaran' => $request->status_pembayaran,
]);
if ($request->status_pembayaran == 'dp') {
$this->cetakNota($id);
}
return redirect()->route('pesanan')->with('message', 'Data berhasil diupdate');
}
public function cetakNota($id)
{
$pesanan = Pesanan::findOrFail($id);
$totalHargaProduk = $pesanan->produk->harga * $pesanan->qty;
$extraCharges = [];
$biayaTambahan = 0;
$ukuranXXLCharge = 0;
$lenganPanjangCharge = 0;
foreach ($pesanan->detailPesanan as $detail) {
if ($detail->ukuran->ukuran === 'XXL') {
$ukuranXXLCharge += 7000 * $detail->qty;
}
if ($detail->ukuran_lengan === 'panjang') {
$lenganPanjangCharge += 10000 * $detail->qty;
}
}
if ($ukuranXXLCharge > 0) {
$extraCharges[] = [
'description' => 'Biaya Ukuran XXL',
'amount' => $ukuranXXLCharge
];
$biayaTambahan += $ukuranXXLCharge;
}
if ($lenganPanjangCharge > 0) {
$extraCharges[] = [
'description' => 'Biaya Lengan Panjang',
'amount' => $lenganPanjangCharge
];
$biayaTambahan += $lenganPanjangCharge;
}
$pdf = FacadePdf::loadView('dashboard.nota-pdf', compact('pesanan', 'extraCharges', 'biayaTambahan'));
$pdf->setPaper(array(0, 0, 298, 520), 'portrait');
$timestamp = Carbon::now()->format('YmdHis');
$pdfFileName = 'nota_' . $pesanan->id . '_' . $timestamp . '.pdf';
$pdfPath = public_path('nota/' . $pdfFileName);
$pdf->save($pdfPath);
$qrCodeFileName = 'qrcodes/' . $pesanan->id . '_' . $timestamp . '.png';
$qrCodePath = public_path('nota/' . $qrCodeFileName);
$pdfUrl = url('nota/' . $pdfFileName);
$qrCode = new QrCodeQrCode($pdfUrl);
$qrCode->setSize(400);
$qrCode->setMargin(10);
$writer = new PngWriter();
$result = $writer->write($qrCode);
$result->saveToFile($qrCodePath);
$pesanan->update([
'nota' => $pdfFileName,
'qr_code' => $qrCodeFileName,
]);
return redirect()->route('pesanan')->with('message', 'Nota telah berhasil dibuat');
}
public function storeOrUpdateBahanBaku(Request $request)
{
$request->validate([
'pesanan_id' => 'required|exists:pesanan,id',
'bahan_baku_id' => 'required|array',
'bahan_baku_id.*' => 'exists:bahan_baku,id',
'qty' => 'required|array',
'qty.*' => 'integer|min:1',
]);
$pesananId = $request->input('pesanan_id');
$bahanBakuIds = $request->input('bahan_baku_id');
$qtys = $request->input('qty');
foreach ($bahanBakuIds as $index => $bahanBakuId) {
$qty = $qtys[$index];
$pesananBahanBaku = PesananBahanBaku::updateOrCreate(
[
'pesanan_id' => $pesananId,
'bahan_baku_id' => $bahanBakuId,
],
[
'qty' => $qty,
]
);
}
return redirect()->back()->with('message', 'Pesanan Bahan Baku updated successfully!');
}
public function laporan_pesanan()
{
$pesanan = Pesanan::with(['user', 'detailPesanan.color', 'detailPesanan.ukuran', 'produk'])->orderByDesc('id')->get();
return view('dashboard.laporan-pesanan', compact('pesanan'));
}
public function exportExcel(Request $request)
{
$startDate = $request->query('start_date');
$endDate = $request->query('end_date');
return Excel::download(new OrdersExport($startDate, $endDate), 'pesanan.xlsx');
}
}

View File

@ -0,0 +1,154 @@
<?php
namespace App\Http\Controllers;
use App\Models\Color;
use App\Models\Kategori;
use App\Models\Produk;
use App\Models\Ukuran;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
class ProdukController extends Controller
{
public function index()
{
$produk = Produk::OrderByDesc('id')->with('kategori')->get();
$kategori = Kategori::all();
$color = Color::all();
$ukuran = Ukuran::all();
return view('dashboard.produk', compact('produk', 'kategori', 'color', 'ukuran'));
}
public function store(Request $request)
{
$validatedData = $request->validate([
'kategori_id' => 'required',
'nama' => 'required',
'deskripsi' => 'required',
'harga' => 'required',
'lengan' => 'required',
'color' => 'required|array',
'color.*' => 'exists:color,id',
'ukuran' => 'required|array',
'ukuran.*' => 'exists:ukuran,id',
'image' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
], [
'image.required' => 'Anda harus mengunggah gambar.',
'image.image' => 'File harus berupa gambar.',
'image.mimes' => 'Gambar harus dalam format JPEG, PNG, JPG, atau GIF.',
'image.max' => 'Ukuran gambar tidak boleh lebih dari 2MB.',
]);
$fileNameImage = time() . '.' . $request->image->extension();
$request->image->move(public_path('foto/product/'), $fileNameImage);
$produk = Produk::create([
'kategori_id' => $validatedData['kategori_id'],
'nama' => $validatedData['nama'],
'lengan' => $validatedData['lengan'],
'image' => $fileNameImage,
'deskripsi' => $validatedData['deskripsi'],
'harga' => $validatedData['harga'],
]);
// Simpan warna
foreach ($validatedData['color'] as $colorId) {
$produk->produkColor()->create([
'color_id' => $colorId,
]);
}
// Simpan ukuran
foreach ($validatedData['ukuran'] as $ukuranId) {
$produk->produkUkuran()->create([
'ukuran_id' => $ukuranId,
]);
}
return redirect()->route('produk')->with('message', 'Produk berhasil ditambahkan.');
}
public function update(Request $request, $id)
{
$validatedData = $request->validate([
'kategori_id' => 'required',
'nama' => 'required',
'deskripsi' => 'required',
'harga' => 'required',
'color' => 'required|array',
'color.*' => 'exists:color,id',
'ukuran' => 'required|array',
'ukuran.*' => 'exists:ukuran,id',
'image' => 'sometimes|image|mimes:jpeg,png,jpg,gif|max:2048',
], [
'image.image' => 'File harus berupa gambar.',
'image.mimes' => 'Gambar harus dalam format JPEG, PNG, JPG, atau GIF.',
'image.max' => 'Ukuran gambar tidak boleh lebih dari 2MB.',
]);
$produk = Produk::findOrFail($id);
$lengan = $request->has('customCheck') ? 1 : 0;
if ($request->hasFile('image')) {
// Hapus gambar lama jika ada
if (file_exists(public_path('foto/product/' . $produk->image))) {
unlink(public_path('foto/product/' . $produk->image));
}
// Simpan gambar baru
$fileNameImage = time() . '.' . $request->image->extension();
$request->image->move(public_path('foto/product/'), $fileNameImage);
$produk->image = $fileNameImage;
}
// Update produk
$produk->update([
'kategori_id' => $validatedData['kategori_id'],
'nama' => $validatedData['nama'],
'deskripsi' => $validatedData['deskripsi'],
'harga' => $validatedData['harga'],
'lengan' => $lengan,
]);
// Update warna
$produk->produkColor()->delete();
foreach ($validatedData['color'] as $colorId) {
$produk->produkColor()->create([
'color_id' => $colorId,
]);
}
// Update ukuran
$produk->produkUkuran()->delete();
foreach ($validatedData['ukuran'] as $ukuranId) {
$produk->produkUkuran()->create([
'ukuran_id' => $ukuranId,
]);
}
return redirect()->route('produk')->with('message', 'Produk berhasil diperbarui.');
}
public function delete($id)
{
$produk = Produk::findOrFail($id);
$deleteimage = Produk::where('id', $id)->first();
File::delete(public_path('foto/product') . '/' . $deleteimage->image);
$produk->delete();
return redirect()->route('produk')->with('message', 'Data berhasil dihapus.');
}
public function getProductById($id)
{
$produk = Produk::with('kategori')->findOrFail($id);
return view('landing.item-produk', compact('produk'));
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
public function index()
{
return view('auth.register');
}
public function register(Request $request)
{
$messages = [
'name.required' => 'Nama wajib diisi.',
'email.required' => 'Email wajib diisi.',
'email.email' => 'Email tidak valid.',
'email.unique' => 'Email sudah digunakan.',
'notelp.required' => 'Nomor telepon wajib diisi.',
'alamat.required' => 'Alamat wajib diisi.',
'password.required' => 'Password wajib diisi.',
'password.min' => 'Password harus minimal 8 karakter.',
'password.confirmed' => 'Konfirmasi password tidak cocok.'
];
$validator = Validator::make($request->all(), [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'notelp' => 'required|string|max:20',
'alamat' => 'required|string|max:255',
'password' => 'required|string|min:8|confirmed',
], $messages);
$validator->validate();
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'notelp' => $request->notelp,
'alamat' => $request->alamat,
'password' => Hash::make($request->password),
]);
return redirect()->route('home')->with('message', 'Registrasi berhasil. Silakan login.');
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Http\Controllers;
use App\Models\Ukuran;
use Illuminate\Http\Request;
class UkuranController extends Controller
{
public function index()
{
$ukuran = Ukuran::OrderByDesc('id')->get();
return view('dashboard.ukuran', compact('ukuran'));
}
public function store(Request $request)
{
$validatedData = $request->validate([
'ukuran' => 'required',
]);
Ukuran::create($validatedData);
return redirect()->route('ukuran')->with('message', 'Data berhasil disimpan.');
}
public function delete($id)
{
$ukuran = Ukuran::findOrFail($id);
$ukuran->delete();
return redirect()->route('ukuran')->with('message', 'Data berhasil dihapus.');
}
public function update(Request $request, $id)
{
$validatedData = $request->validate([
'ukuran' => 'required',
]);
$ukuran = Ukuran::findOrFail($id);
$ukuran->update($validatedData);
return redirect()->route('ukuran')->with('message', 'Data berhasil diperbarui.');
}
}

View File

@ -0,0 +1,54 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
class UserController extends Controller
{
public function index()
{
$user = User::OrderByDesc('id')->where('is_admin', '0')->get();
return view('dashboard.user', compact('user'));
}
public function updateUser(Request $request)
{
$validateData = $request->validate([
'name' => 'required',
'alamat' => 'required',
'notelp' => 'required',
'email' => 'required',
]);
$user = Auth::user()->id;
$users = User::findOrFail($user);
$users->update($validateData);
return redirect()->back()->with('message', 'data berhasil diupdate');
}
public function updatePassword(Request $request)
{
$validateData = $request->validate([
'new_password' => 'required|min:8',
'confirm_password' => 'required|same:new_password',
], [
'confirm_password.same' => 'Konfirmasi password tidak cocok dengan password baru.',
]);
$user = Auth::user();
$hashedPassword = Hash::make($validateData['new_password']);
$user->password = $hashedPassword;
$user->save();
return redirect()->back()->with('message', 'Kata sandi berhasil diperbarui');
}
}

71
app/Http/Kernel.php Normal file
View File

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

View File

@ -0,0 +1,25 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class AuthUser
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if (Auth::check() && Auth::user()->is_admin == 0) {
return $next($request);
}
return redirect('/')->with('message', 'Akses Ditolak, Silahkan login/daftar terlebih dahulu untuk melakukan pemesanan.');
}
}

View File

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

View File

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

View File

@ -0,0 +1,25 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class NoAuthUser
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if (Auth::check() && Auth::user()->is_admin == 0) {
return redirect('/dashboard/user')->with('message', 'Login berhasil sebagai user.');
} else {
return $next($request);
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class isAuth
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if (Auth::check() && Auth::user()->is_admin == 1) {
return $next($request);
}
return redirect('/')->with('message', 'Akses ditolak, hanya admin, silahkan login terlebih dahulu');
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class isNoAuth
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if (Auth::check() && Auth::user()->is_admin == 1) {
return redirect('/dashboard')->with('message', 'Login berhasil sebagai admin.');
} else {
return $next($request);
}
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StorePesananRequest 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<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdatePesananRequest 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<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class SomeMailableClass extends Mailable
{
use Queueable, SerializesModels;
protected $token;
/**
* Create a new message instance.
*/
public function __construct($token)
{
$this->token = $token;
}
public function build()
{
return $this->view('auth.mail-reset-password')
->with(['token' => $this->token])
->subject('Lupa Password');
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
from: new Address(config('mail.from.address'), config('mail.from.name')),
subject: 'Lupa Password',
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
view: 'auth.mail-reset-password',
with: [
'token' => $this->token
]
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}

35
app/Models/BahanBaku.php Normal file
View File

@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
class BahanBaku extends Model
{
use HasFactory;
protected $fillable = [
'nama',
'harga',
'qty',
'total_harga',
];
protected $table = 'bahan_baku';
public function transaksiMasuk(): HasMany
{
return $this->hasMany(TransaksiMasuk::class);
}
public function transaksiKeluar(): HasMany
{
return $this->hasMany(TransaksiKeluar::class);
}
public function detailBahanBaku()
{
return $this->hasMany(PesananBahanBaku::class);
}
}

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

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Bank extends Model
{
use HasFactory;
protected $fillable = [
'nama',
'no_rekening',
];
protected $table = 'bank';
public function pesanan(): HasMany
{
return $this->hasMany(Pesanan::class);
}
}

33
app/Models/Color.php Normal file
View File

@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Color extends Model
{
use HasFactory;
protected $fillable = [
'name_color',
'code_color',
];
protected $table = 'color';
public function produkColor()
{
return $this->hasMany(ProdukColor::class);
}
public function pesananColor()
{
return $this->hasMany(PesananColor::class);
}
public function detailPesanan()
{
return $this->hasMany(DetailPesanan::class);
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class DetailPesanan extends Model
{
use HasFactory;
protected $fillable = [
'pesanan_id',
'ukuran_id',
'color_id',
'qty',
'ukuran_lengan',
];
protected $table = 'detail_pesanan';
public function pesanan()
{
return $this->belongsTo(Pesanan::class);
}
public function color()
{
return $this->belongsTo(Color::class);
}
public function ukuran()
{
return $this->belongsTo(Ukuran::class);
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class DetailProduk extends Model
{
use HasFactory;
protected $fillable = [
'produk_id',
'color_id',
'ukuran_id',
];
protected $table = 'detail_produk';
public function produk()
{
return $this->belongsTo(Produk::class, 'produk_id');
}
public function color()
{
return $this->belongsTo(Color::class, 'color_id');
}
public function ukuran()
{
return $this->belongsTo(Ukuran::class, 'ukuran_id');
}
}

30
app/Models/Kategori.php Normal file
View File

@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
class Kategori extends Model
{
use HasFactory;
protected $fillable = [
'nama',
];
protected $table = 'kategori';
public function produk(): HasMany
{
return $this->hasMany(Produk::class);
}
public function scopeWithTotalProduk(Builder $query)
{
return $query->withCount('produk');
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PasswordReset extends Model
{
use HasFactory;
public $timestamps = false;
protected $fillable = ['email', 'token', 'created_at'];
}

30
app/Models/Pengiriman.php Normal file
View File

@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Pengiriman extends Model
{
use HasFactory;
protected $fillable = [
'status',
'tanggal_pengiriman',
'tanggal_tiba',
'alamat_tujuan',
'alamat',
'estimasi',
'jasa_ekspedisi',
'harga_ongkir'
];
protected $table = 'pengiriman';
public function pesanan()
{
return $this->hasMany(Pesanan::class);
}
}

63
app/Models/Pesanan.php Normal file
View File

@ -0,0 +1,63 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
class Pesanan extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'produk_id',
'pengiriman_id',
'qty',
'nota',
'qr_code',
'jasa_ekspedisi',
'harga_ongkir',
'grand_total',
'status',
'bukti',
'bukti_pelunasan',
'pengiriman',
'status_pembayaran',
'detail_pesanan',
'detail_alamat',
];
protected $table = 'pesanan';
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
public function produk()
{
return $this->belongsTo(Produk::class, 'produk_id');
}
public function pengirimans()
{
return $this->belongsTo(Pengiriman::class, 'pengiriman_id');
}
public function transaksiKeluar(): HasMany
{
return $this->hasMany(TransaksiKeluar::class);
}
public function detailPesanan()
{
return $this->hasMany(DetailPesanan::class);
}
public function detailPesananBahanBaku()
{
return $this->hasMany(PesananBahanBaku::class);
}
}

View File

@ -0,0 +1,78 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PesananBahanBaku extends Model
{
use HasFactory;
protected $fillable = [
'pesanan_id',
'bahan_baku_id',
'qty',
];
protected $table = 'detail_pesanan_bahan_baku';
public $incrementing = false;
protected $primaryKey = ['pesanan_id', 'bahan_baku_id'];
public $timestamps = true;
public function bahanBaku()
{
return $this->belongsTo(BahanBaku::class, 'bahan_baku_id');
}
public function pesanan()
{
return $this->belongsTo(Pesanan::class, 'pesanan_id');
}
public function setKeysForSaveQuery($query)
{
$keys = $this->getKeyName();
if (!is_array($keys)) {
return parent::setKeysForSaveQuery($query);
}
foreach ($keys as $keyName) {
$query->where($keyName, '=', $this->getKeyForSaveQuery($keyName));
}
return $query;
}
protected function getKeyForSaveQuery($keyName = null)
{
if (is_null($keyName)) {
$keyName = $this->getKeyName();
}
return $this->original[$keyName] ?? $this->getAttribute($keyName);
}
protected static function boot()
{
parent::boot();
static::saved(function ($pesananBahanBaku) {
$transaksiKeluar = TransaksiKeluar::updateOrCreate(
[
'bahan_baku_id' => $pesananBahanBaku->bahan_baku_id,
'pesanan_id' => $pesananBahanBaku->pesanan_id,
],
[
'qty' => $pesananBahanBaku->qty,
]
);
$bahanBaku = BahanBaku::find($pesananBahanBaku->bahan_baku_id);
$totalQtyKeluar = TransaksiKeluar::where('bahan_baku_id', $bahanBaku->id)->sum('qty');
$totalQtyMasuk = TransaksiMasuk::where('bahan_baku_id', $bahanBaku->id)->sum('qty');
$bahanBaku->qty = $totalQtyMasuk - $totalQtyKeluar;
$bahanBaku->save();
});
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PesananColor extends Model
{
use HasFactory;
protected $fillable = [
'pesanan_id',
'color_id',
'qty',
];
protected $table = 'detail_pesanan_color';
public function color()
{
return $this->belongsTo(Color::class, 'color_id');
}
public function pesanan()
{
return $this->belongsTo(Pesanan::class, 'pesanan_id');
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PesananUkuran extends Model
{
use HasFactory;
protected $fillable = [
'pesanan_id',
'ukuran_id',
'qty',
];
protected $table = 'detail_pesanan_ukuran';
public function pesanan()
{
return $this->belongsTo(Pesanan::class, 'pesanan_id');
}
public function ukuran()
{
return $this->belongsTo(Ukuran::class, 'ukuran_id');
}
}

39
app/Models/Produk.php Normal file
View File

@ -0,0 +1,39 @@
<?php
namespace App\Models;
use App\Traits\HasFormatRupiah;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Produk extends Model
{
use HasFactory;
use HasFormatRupiah;
protected $fillable = [
'kategori_id',
'nama',
'image',
'deskripsi',
'harga',
'lengan',
];
protected $table = 'produk';
public function produkColor()
{
return $this->hasMany(ProdukColor::class);
}
public function produkUkuran()
{
return $this->hasMany(ProdukUkuran::class);
}
public function kategori()
{
return $this->belongsTo(Kategori::class, 'kategori_id');
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProdukColor extends Model
{
use HasFactory;
protected $fillable = [
'produk_id',
'color_id',
];
protected $table = 'detail_produk_color';
public function produk()
{
return $this->belongsTo(Produk::class, 'produk_id');
}
public function color()
{
return $this->belongsTo(Color::class, 'color_id');
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProdukUkuran extends Model
{
use HasFactory;
protected $fillable = [
'produk_id',
'ukuran_id',
];
protected $table = 'detail_produk_ukuran';
public function produk()
{
return $this->belongsTo(Produk::class, 'produk_id');
}
public function ukuran()
{
return $this->belongsTo(Ukuran::class, 'ukuran_id');
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class TransaksiKeluar extends Model
{
use HasFactory;
protected $fillable = [
'bahan_baku_id',
'pesanan_id',
'qty',
];
protected $table = 'transaksi_keluar';
public function bahanBaku()
{
return $this->belongsTo(BahanBaku::class, 'bahan_baku_id');
}
public function pesanan()
{
return $this->belongsTo(Pesanan::class, 'pesanan_id');
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class TransaksiMasuk extends Model
{
use HasFactory;
protected $fillable = [
'bahan_baku_id',
'qty',
];
protected $table = 'transaksi_masuk';
public function bahanBaku()
{
return $this->belongsTo(BahanBaku::class, 'bahan_baku_id');
}
}

32
app/Models/Ukuran.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 Ukuran extends Model
{
use HasFactory;
protected $fillable = [
'ukuran',
];
protected $table = 'ukuran';
public function produkUkuran()
{
return $this->hasMany(ProdukUkuran::class);
}
public function pesananUkuran()
{
return $this->hasMany(PesananUkuran::class);
}
public function detailPesanan()
{
return $this->hasMany(DetailPesanan::class);
}
}

53
app/Models/User.php Normal file
View File

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

View File

@ -0,0 +1,66 @@
<?php
namespace App\Policies;
use App\Models\Pesanan;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class PesananPolicy
{
/**
* 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, Pesanan $pesanan): 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, Pesanan $pesanan): bool
{
//
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Pesanan $pesanan): bool
{
//
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, Pesanan $pesanan): bool
{
//
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, Pesanan $pesanan): bool
{
//
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,16 @@
<?php
namespace App\Traits;
trait HasFormatRupiah
{
function formatRupiah($field, $prefix =null)
{
$prefix = $prefix ? $prefix : 'Rp. ';
$nominal = $this->attributes[$field];
return $prefix . number_format($nominal, 0, ',', '.');
}
}
?>

53
artisan Normal file
View File

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

55
bootstrap/app.php Normal file
View File

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

2
bootstrap/cache/.gitignore vendored Normal file
View File

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

75
composer.json Normal file
View File

@ -0,0 +1,75 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^8.1",
"barryvdh/laravel-dompdf": "^2.2",
"endroid/qr-code": "^5.0",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.0",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"maatwebsite/excel": "^3.1",
"midtrans/midtrans-php": "^2.5"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"branch-alias": {
"dev-master": "10.x-dev"
},
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

9237
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

215
config/app.php Normal file
View File

@ -0,0 +1,215 @@
<?php
use Illuminate\Support\Facades\Facade;
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', '/'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => 'file',
// 'store' => 'redis',
],
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => Facade::defaultAliases()->merge([
// 'ExampleClass' => App\Example\ExampleClass::class,
])->toArray(),
];

115
config/auth.php Normal file
View File

@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];

70
config/broadcasting.php Normal file
View File

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

110
config/cache.php Normal file
View File

@ -0,0 +1,110 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
'lock_connection' => 'default',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
| stores there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
];

34
config/cors.php Normal file
View File

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

151
config/database.php Normal file
View File

@ -0,0 +1,151 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

284
config/dompdf.php Normal file
View File

@ -0,0 +1,284 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Settings
|--------------------------------------------------------------------------
|
| Set some default values. It is possible to add all defines that can be set
| in dompdf_config.inc.php. You can also override the entire config file.
|
*/
'show_warnings' => false, // Throw an Exception on warnings from dompdf
'public_path' => null, // Override the public path if needed
/*
* Dejavu Sans font is missing glyphs for converted entities, turn it off if you need to show and £.
*/
'convert_entities' => true,
'options' => array(
/**
* The location of the DOMPDF font directory
*
* The location of the directory where DOMPDF will store fonts and font metrics
* Note: This directory must exist and be writable by the webserver process.
* *Please note the trailing slash.*
*
* Notes regarding fonts:
* Additional .afm font metrics can be added by executing load_font.php from command line.
*
* Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
* be embedded in the pdf file or the PDF may not display correctly. This can significantly
* increase file size unless font subsetting is enabled. Before embedding a font please
* review your rights under the font license.
*
* Any font specification in the source HTML is translated to the closest font available
* in the font directory.
*
* The pdf standard "Base 14 fonts" are:
* Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
* Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
* Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
* Symbol, ZapfDingbats.
*/
"font_dir" => storage_path('fonts'), // advised by dompdf (https://github.com/dompdf/dompdf/pull/782)
/**
* The location of the DOMPDF font cache directory
*
* This directory contains the cached font metrics for the fonts used by DOMPDF.
* This directory can be the same as DOMPDF_FONT_DIR
*
* Note: This directory must exist and be writable by the webserver process.
*/
"font_cache" => storage_path('fonts'),
/**
* The location of a temporary directory.
*
* The directory specified must be writeable by the webserver process.
* The temporary directory is required to download remote images and when
* using the PDFLib back end.
*/
"temp_dir" => sys_get_temp_dir(),
/**
* ==== IMPORTANT ====
*
* dompdf's "chroot": Prevents dompdf from accessing system files or other
* files on the webserver. All local files opened by dompdf must be in a
* subdirectory of this directory. DO NOT set it to '/' since this could
* allow an attacker to use dompdf to read any files on the server. This
* should be an absolute path.
* This is only checked on command line call by dompdf.php, but not by
* direct class use like:
* $dompdf = new DOMPDF(); $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
*/
"chroot" => realpath(base_path()),
/**
* Protocol whitelist
*
* Protocols and PHP wrappers allowed in URIs, and the validation rules
* that determine if a resouce may be loaded. Full support is not guaranteed
* for the protocols/wrappers specified
* by this array.
*
* @var array
*/
'allowed_protocols' => [
"file://" => ["rules" => []],
"http://" => ["rules" => []],
"https://" => ["rules" => []]
],
/**
* @var string
*/
'log_output_file' => null,
/**
* Whether to enable font subsetting or not.
*/
"enable_font_subsetting" => false,
/**
* The PDF rendering backend to use
*
* Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
* 'auto'. 'auto' will look for PDFLib and use it if found, or if not it will
* fall back on CPDF. 'GD' renders PDFs to graphic files. {@link
* Canvas_Factory} ultimately determines which rendering class to instantiate
* based on this setting.
*
* Both PDFLib & CPDF rendering backends provide sufficient rendering
* capabilities for dompdf, however additional features (e.g. object,
* image and font support, etc.) differ between backends. Please see
* {@link PDFLib_Adapter} for more information on the PDFLib backend
* and {@link CPDF_Adapter} and lib/class.pdf.php for more information
* on CPDF. Also see the documentation for each backend at the links
* below.
*
* The GD rendering backend is a little different than PDFLib and
* CPDF. Several features of CPDF and PDFLib are not supported or do
* not make any sense when creating image files. For example,
* multiple pages are not supported, nor are PDF 'objects'. Have a
* look at {@link GD_Adapter} for more information. GD support is
* experimental, so use it at your own risk.
*
* @link http://www.pdflib.com
* @link http://www.ros.co.nz/pdf
* @link http://www.php.net/image
*/
"pdf_backend" => "CPDF",
/**
* PDFlib license key
*
* If you are using a licensed, commercial version of PDFlib, specify
* your license key here. If you are using PDFlib-Lite or are evaluating
* the commercial version of PDFlib, comment out this setting.
*
* @link http://www.pdflib.com
*
* If pdflib present in web server and auto or selected explicitely above,
* a real license code must exist!
*/
//"DOMPDF_PDFLIB_LICENSE" => "your license key here",
/**
* html target media view which should be rendered into pdf.
* List of types and parsing rules for future extensions:
* http://www.w3.org/TR/REC-html40/types.html
* screen, tty, tv, projection, handheld, print, braille, aural, all
* Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
* Note, even though the generated pdf file is intended for print output,
* the desired content might be different (e.g. screen or projection view of html file).
* Therefore allow specification of content here.
*/
"default_media_type" => "screen",
/**
* The default paper size.
*
* North America standard is "letter"; other countries generally "a4"
*
* @see CPDF_Adapter::PAPER_SIZES for valid sizes ('letter', 'legal', 'A4', etc.)
*/
"default_paper_size" => "a4",
/**
* The default paper orientation.
*
* The orientation of the page (portrait or landscape).
*
* @var string
*/
'default_paper_orientation' => "portrait",
/**
* The default font family
*
* Used if no suitable fonts can be found. This must exist in the font folder.
* @var string
*/
"default_font" => "serif",
/**
* Image DPI setting
*
* This setting determines the default DPI setting for images and fonts. The
* DPI may be overridden for inline images by explictly setting the
* image's width & height style attributes (i.e. if the image's native
* width is 600 pixels and you specify the image's width as 72 points,
* the image will have a DPI of 600 in the rendered PDF. The DPI of
* background images can not be overridden and is controlled entirely
* via this parameter.
*
* For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
* If a size in html is given as px (or without unit as image size),
* this tells the corresponding size in pt.
* This adjusts the relative sizes to be similar to the rendering of the
* html page in a reference browser.
*
* In pdf, always 1 pt = 1/72 inch
*
* Rendering resolution of various browsers in px per inch:
* Windows Firefox and Internet Explorer:
* SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
* Linux Firefox:
* about:config *resolution: Default:96
* (xorg screen dimension in mm and Desktop font dpi settings are ignored)
*
* Take care about extra font/image zoom factor of browser.
*
* In images, <img> size in pixel attribute, img css style, are overriding
* the real image dimension in px for rendering.
*
* @var int
*/
"dpi" => 96,
/**
* Enable inline PHP
*
* If this setting is set to true then DOMPDF will automatically evaluate
* inline PHP contained within <script type="text/php"> ... </script> tags.
*
* Enabling this for documents you do not trust (e.g. arbitrary remote html
* pages) is a security risk. Set this option to false if you wish to process
* untrusted documents.
*
* @var bool
*/
"enable_php" => false,
/**
* Enable inline Javascript
*
* If this setting is set to true then DOMPDF will automatically insert
* JavaScript code contained within <script type="text/javascript"> ... </script> tags.
*
* @var bool
*/
"enable_javascript" => true,
/**
* Enable remote file access
*
* If this setting is set to true, DOMPDF will access remote sites for
* images and CSS files as required.
* This is required for part of test case www/test/image_variants.html through www/examples.php
*
* Attention!
* This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and
* allowing remote access to dompdf.php or on allowing remote html code to be passed to
* $dompdf = new DOMPDF(, $dompdf->load_html(...,
* This allows anonymous users to download legally doubtful internet content which on
* tracing back appears to being downloaded by your server, or allows malicious php code
* in remote html pages to be executed by your server with your account privileges.
*
* @var bool
*/
"enable_remote" => true,
/**
* A ratio applied to the fonts height to be more like browsers' line height
*/
"font_height_ratio" => 1.1,
/**
* Use the HTML5 Lib parser
*
* @deprecated This feature is now always on in dompdf 2.x
* @var bool
*/
"enable_html5_parser" => true,
),
);

379
config/excel.php Normal file
View File

@ -0,0 +1,379 @@
<?php
use Maatwebsite\Excel\Excel;
return [
'exports' => [
/*
|--------------------------------------------------------------------------
| Chunk size
|--------------------------------------------------------------------------
|
| When using FromQuery, the query is automatically chunked.
| Here you can specify how big the chunk should be.
|
*/
'chunk_size' => 1000,
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
|--------------------------------------------------------------------------
*/
'pre_calculate_formulas' => false,
/*
|--------------------------------------------------------------------------
| Enable strict null comparison
|--------------------------------------------------------------------------
|
| When enabling strict null comparison empty cells ('') will
| be added to the sheet.
*/
'strict_null_comparison' => false,
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
*/
'csv' => [
'delimiter' => ',',
'enclosure' => '"',
'line_ending' => PHP_EOL,
'use_bom' => false,
'include_separator_line' => false,
'excel_compatibility' => false,
'output_encoding' => '',
'test_auto_detect' => true,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
'imports' => [
/*
|--------------------------------------------------------------------------
| Read Only
|--------------------------------------------------------------------------
|
| When dealing with imports, you might only be interested in the
| data that the sheet exists. By default we ignore all styles,
| however if you want to do some logic based on style data
| you can enable it by setting read_only to false.
|
*/
'read_only' => true,
/*
|--------------------------------------------------------------------------
| Ignore Empty
|--------------------------------------------------------------------------
|
| When dealing with imports, you might be interested in ignoring
| rows that have null values or empty strings. By default rows
| containing empty strings or empty values are not ignored but can be
| ignored by enabling the setting ignore_empty to true.
|
*/
'ignore_empty' => false,
/*
|--------------------------------------------------------------------------
| Heading Row Formatter
|--------------------------------------------------------------------------
|
| Configure the heading row formatter.
| Available options: none|slug|custom
|
*/
'heading_row' => [
'formatter' => 'slug',
],
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
*/
'csv' => [
'delimiter' => null,
'enclosure' => '"',
'escape_character' => '\\',
'contiguous' => false,
'input_encoding' => 'UTF-8',
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
/*
|--------------------------------------------------------------------------
| Cell Middleware
|--------------------------------------------------------------------------
|
| Configure middleware that is executed on getting a cell value
|
*/
'cells' => [
'middleware' => [
//\Maatwebsite\Excel\Middleware\TrimCellValue::class,
//\Maatwebsite\Excel\Middleware\ConvertEmptyCellValuesToNull::class,
],
],
],
/*
|--------------------------------------------------------------------------
| Extension detector
|--------------------------------------------------------------------------
|
| Configure here which writer/reader type should be used when the package
| needs to guess the correct type based on the extension alone.
|
*/
'extension_detector' => [
'xlsx' => Excel::XLSX,
'xlsm' => Excel::XLSX,
'xltx' => Excel::XLSX,
'xltm' => Excel::XLSX,
'xls' => Excel::XLS,
'xlt' => Excel::XLS,
'ods' => Excel::ODS,
'ots' => Excel::ODS,
'slk' => Excel::SLK,
'xml' => Excel::XML,
'gnumeric' => Excel::GNUMERIC,
'htm' => Excel::HTML,
'html' => Excel::HTML,
'csv' => Excel::CSV,
'tsv' => Excel::TSV,
/*
|--------------------------------------------------------------------------
| PDF Extension
|--------------------------------------------------------------------------
|
| Configure here which Pdf driver should be used by default.
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
*/
'pdf' => Excel::DOMPDF,
],
/*
|--------------------------------------------------------------------------
| Value Binder
|--------------------------------------------------------------------------
|
| PhpSpreadsheet offers a way to hook into the process of a value being
| written to a cell. In there some assumptions are made on how the
| value should be formatted. If you want to change those defaults,
| you can implement your own default value binder.
|
| Possible value binders:
|
| [x] Maatwebsite\Excel\DefaultValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
*/
'value_binder' => [
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
],
'cache' => [
/*
|--------------------------------------------------------------------------
| Default cell caching driver
|--------------------------------------------------------------------------
|
| By default PhpSpreadsheet keeps all cell values in memory, however when
| dealing with large files, this might result into memory issues. If you
| want to mitigate that, you can configure a cell caching driver here.
| When using the illuminate driver, it will store each value in the
| cache store. This can slow down the process, because it needs to
| store each value. You can use the "batch" store if you want to
| only persist to the store when the memory limit is reached.
|
| Drivers: memory|illuminate|batch
|
*/
'driver' => 'memory',
/*
|--------------------------------------------------------------------------
| Batch memory caching
|--------------------------------------------------------------------------
|
| When dealing with the "batch" caching driver, it will only
| persist to the store when the memory limit is reached.
| Here you can tweak the memory limit to your liking.
|
*/
'batch' => [
'memory_limit' => 60000,
],
/*
|--------------------------------------------------------------------------
| Illuminate cache
|--------------------------------------------------------------------------
|
| When using the "illuminate" caching driver, it will automatically use
| your default cache store. However if you prefer to have the cell
| cache on a separate store, you can configure the store name here.
| You can use any store defined in your cache config. When leaving
| at "null" it will use the default store.
|
*/
'illuminate' => [
'store' => null,
],
/*
|--------------------------------------------------------------------------
| Cache Time-to-live (TTL)
|--------------------------------------------------------------------------
|
| The TTL of items written to cache. If you want to keep the items cached
| indefinitely, set this to null. Otherwise, set a number of seconds,
| a \DateInterval, or a callable.
|
| Allowable types: callable|\DateInterval|int|null
|
*/
'default_ttl' => 10800,
],
/*
|--------------------------------------------------------------------------
| Transaction Handler
|--------------------------------------------------------------------------
|
| By default the import is wrapped in a transaction. This is useful
| for when an import may fail and you want to retry it. With the
| transactions, the previous import gets rolled-back.
|
| You can disable the transaction handler by setting this to null.
| Or you can choose a custom made transaction handler here.
|
| Supported handlers: null|db
|
*/
'transactions' => [
'handler' => 'db',
'db' => [
'connection' => null,
],
],
'temporary_files' => [
/*
|--------------------------------------------------------------------------
| Local Temporary Path
|--------------------------------------------------------------------------
|
| When exporting and importing files, we use a temporary file, before
| storing reading or downloading. Here you can customize that path.
| permissions is an array with the permission flags for the directory (dir)
| and the create file (file).
|
*/
'local_path' => storage_path('framework/cache/laravel-excel'),
/*
|--------------------------------------------------------------------------
| Local Temporary Path Permissions
|--------------------------------------------------------------------------
|
| Permissions is an array with the permission flags for the directory (dir)
| and the create file (file).
| If omitted the default permissions of the filesystem will be used.
|
*/
'local_permissions' => [
// 'dir' => 0755,
// 'file' => 0644,
],
/*
|--------------------------------------------------------------------------
| Remote Temporary Disk
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup with queues in which you
| cannot rely on having a shared local temporary path, you might
| want to store the temporary file on a shared disk. During the
| queue executing, we'll retrieve the temporary file from that
| location instead. When left to null, it will always use
| the local path. This setting only has effect when using
| in conjunction with queued imports and exports.
|
*/
'remote_disk' => null,
'remote_prefix' => null,
/*
|--------------------------------------------------------------------------
| Force Resync
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup as above, it's possible
| for the clean up that occurs after entire queue has been run to only
| cleanup the server that the last AfterImportJob runs on. The rest of the server
| would still have the local temporary file stored on it. In this case your
| local storage limits can be exceeded and future imports won't be processed.
| To mitigate this you can set this config value to be true, so that after every
| queued chunk is processed the local temporary file is deleted on the server that
| processed it.
|
*/
'force_resync_remote' => null,
],
];

76
config/filesystems.php Normal file
View File

@ -0,0 +1,76 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been set up for each driver as an example of the required values.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

52
config/hashing.php Normal file
View File

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

122
config/logging.php Normal file
View File

@ -0,0 +1,122 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => false,
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

124
config/mail.php Normal file
View File

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

8
config/midtrans.php Normal file
View File

@ -0,0 +1,8 @@
<?php
return [
'serverKey' => env('MIDTRANS_SERVER_KEY'),
'isProduction' => env('MIDTRANS_IS_PRODUCTION'),
'isSanitized' => env('MIDTRANS_IS_SANITIZED'),
'is3ds' => env('MIDTRANS_IS_3DS'),
];

93
config/queue.php Normal file
View File

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

67
config/sanctum.php Normal file
View File

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

34
config/services.php Normal file
View File

@ -0,0 +1,34 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
'scheme' => 'https',
],
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];

201
config/session.php Normal file
View File

@ -0,0 +1,201 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => 'lax',
];

36
config/view.php Normal file
View File

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

1
database/.gitignore vendored Normal file
View File

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

View File

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

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('notelp', 13)->nullable();
$table->string('alamat')->nullable();
$table->string('password')->nullable();
$table->tinyInteger('is_admin')->default(0);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};

View File

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

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('failed_jobs');
}
};

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

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

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