Initial commit

This commit is contained in:
AJISAKA SIDDIQ 2024-07-11 09:21:54 +07:00
commit c2b03623cc
2111 changed files with 232399 additions and 0 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

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

19
.gitignore vendored Normal file
View File

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

66
README.md Normal file
View File

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

View File

@ -0,0 +1,59 @@
<?php
namespace App\Console\Commands;
use Carbon\Carbon;
use App\Models\Transaksi;
use App\Mail\BillingEmail;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
class SendBillingEmails extends Command
{
protected $signature = 'billing:send';
protected $description = 'Send billing emails based on due dates';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$today = Carbon::now()->timezone('Asia/Jakarta')->toDateString();
$transaksis = Transaksi::with('user', 'jenistagihan')
->where('status', '0')
->whereDate('date_akhir', $today)
->get();
// Kelompokkan transaksi berdasarkan tagihan_id
$groupedTransaksis = $transaksis->groupBy('tagihan_id');
foreach ($groupedTransaksis as $tagihanId => $transaksiGroup) {
// Ambil pengguna berdasarkan user_id (sama untuk semua transaksi dalam satu grup)
$user = $transaksiGroup->first()->user;
// Buat array tagihan untuk email
$tagihans = [];
foreach ($transaksiGroup as $transaksi) {
$tagihans[$tagihanId][] = [
'nama' => optional($transaksi->jenistagihan)->name,
'keterangan' => $transaksi->keterangan,
'total_tagihan' => $transaksi->total,
];
}
// Kirim email tagihan ke pengguna yang sama
Mail::to($user->email)
->send(new BillingEmail($user, $tagihans));
// Tandai transaksi sebagai sudah dikirim email tagihan
foreach ($transaksiGroup as $transaksi) {
$transaksi->email_terkirim = true;
$transaksi->save();
}
}
$this->info('Billing emails sent successfully.');
}
}

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,30 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* The 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,16 @@
<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\FromCollection;
class DataExport implements FromCollection
{
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
//
}
}

View File

@ -0,0 +1,85 @@
<?php
namespace App\Exports;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class LaporanExport implements FromView, WithStyles
{
protected $transactions;
protected $totalsaldo;
protected $bulan;
protected $tahun;
protected $totalpengeluaran;
public function __construct($transactions, $totalsaldo, $bulan, $tahun, $totalpengeluaran)
{
$this->transactions = $transactions;
$this->totalsaldo = $totalsaldo;
$this->bulan = $bulan;
$this->tahun = $tahun;
$this->totalpengeluaran = $totalpengeluaran;
}
public function view(): View
{
return view('export.laporan', [
'transactions' => $this->transactions,
'totalsaldo' => $this->totalsaldo,
'bulan' => $this->bulan,
'tahun' => $this->tahun,
'totalpengeluaran' => $this->totalpengeluaran,
]);
}
public function styles(Worksheet $sheet)
{
// Atur styling untuk header tabel
$sheet->getStyle('A2:D2')->applyFromArray([
'font' => ['bold' => true],
'fill' => ['fillType' => 'solid', 'startColor' => ['rgb' => 'B0E57C']],
'alignment' => ['horizontal' => 'center']
]);
// Atur styling untuk isi tabel
$sheet->getStyle('A3:D' . (count($this->transactions) + 3))->applyFromArray([
'alignment' => ['horizontal' => 'center']
]);
// Mengatur header
$sheet->getStyle('A1:D1')->applyFromArray([
'font' => [
'bold' => true,
'color' => ['rgb' => '000000']
],
'fill' => [
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'startColor' => ['rgb' => 'F2F2F2']
],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER
],
'borders' => [
'allBorders' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
'color' => ['rgb' => 'DDDDDD']
]
]
]);
// Atur lebar kolom
$sheet->getColumnDimension('A')->setWidth(5);
$sheet->getColumnDimension('B')->setWidth(20);
$sheet->getColumnDimension('C')->setWidth(20);
$sheet->getColumnDimension('D')->setWidth(20);
// Atur tinggi baris
$sheet->getRowDimension('2')->setRowHeight(25);
for ($row = 3; $row <= count($this->transactions) + 3; $row++) {
$sheet->getRowDimension($row)->setRowHeight(20);
}
}
}

View File

@ -0,0 +1,111 @@
<?php
namespace App\Exports;
use Carbon\Carbon;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class RekapitulasiExport implements FromView, WithStyles
{
protected $data;
protected $jumlahtotal;
protected $title;
protected $bulan;
protected $tahun;
public function __construct($data, $jumlahtotal, $title, $bulan, $tahun)
{
$this->data = $data;
$this->jumlahtotal = $jumlahtotal;
$this->title = $title;
$this->bulan = $bulan;
$this->tahun = $tahun;
}
public function view(): View
{
return view('export.rekap', [
'data' => $this->data,
'jumlahtotal' => $this->jumlahtotal,
'title' => $this->title,
'bulan' => $this->bulan,
'tahun' => $this->tahun,
]);
}
public function styles(Worksheet $sheet)
{
// Mengatur lebar kolom agar sesuai dengan konten
$sheet->getColumnDimension('A')->setWidth(5);
$sheet->getColumnDimension('B')->setWidth(25);
$sheet->getColumnDimension('C')->setWidth(20);
$sheet->getColumnDimension('D')->setWidth(20);
// Mengatur header
$sheet->getStyle('A2:D2')->applyFromArray([
'font' => [
'bold' => true,
'color' => ['rgb' => '000000']
],
'fill' => [
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'startColor' => ['rgb' => 'F2F2F2']
],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER
],
'borders' => [
'allBorders' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
'color' => ['rgb' => 'DDDDDD']
]
]
]);
// Mengatur isi tabel
$highestRow = $sheet->getHighestRow();
$sheet->getStyle("A3:F$highestRow")->applyFromArray([
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER
],
'borders' => [
'allBorders' => [
'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
'color' => ['rgb' => 'DDDDDD']
]
]
]);
// Mengatur gaya judul dan posisinya
$sheet->mergeCells('A1:D1');
$titleText = 'Rekapitulasi ' . $this->title;
if ($this->bulan && $this->tahun) {
$titleText .= ' Bulan ' . Carbon::createFromFormat('m', $this->bulan)->translatedFormat('F') . ' Tahun ' . $this->tahun;
}
$sheet->setCellValue('A1', $titleText);
$sheet->getStyle('A1')->applyFromArray([
'font' => [
'bold' => true,
'size' => 14,
],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER
]
]);
// Mengatur styling untuk jumlah total
$sheet->getStyle("F" . ($highestRow + 1))->applyFromArray([
'font' => [
'bold' => true,
],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT
]
]);
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\profile;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
class ProfileWebController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$profile = profile::get();
// Mendapatkan tanggal hari ini
// $today = Carbon::now()->toDateString();
$user = Auth::user();
if ($user->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
// Mengambil transaksi terbaru pada tanggal hari ini
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
return view('pages.edit-profileweb', compact('profile', 'trans', 'totaltransaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
try {
$item = profile::findOrFail($id);
$data = $request->all();
if ($request->hasFile('foto')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['foto'] = $request->file('foto')->store('assets/foto', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['foto'] = $item->foto;
}
$item->update($data);
return redirect()->route('Profile-Web.index')->with('success', 'Data berhasil diperbarui.');
} catch (\Exception $e) {
dd($e);
return redirect()->back()->with('error', 'Terjadi kesalahan: ' . $e->getMessage());
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
class AuthenticatedSessionController extends Controller
{
/**
* Display the login view.
*/
public function create(): View
{
return view('auth.login');
}
/**
* Handle an incoming authentication request.
*/
public function store(LoginRequest $request): RedirectResponse
{
$request->authenticate();
$request->session()->regenerate();
return redirect()->intended(RouteServiceProvider::HOME);
}
/**
* Destroy an authenticated session.
*/
public function destroy(Request $request): RedirectResponse
{
Auth::guard('web')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/login');
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,73 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\Models\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
}

View File

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

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
}

View File

@ -0,0 +1,42 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View File

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

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,184 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Yajra\DataTables\Facades\DataTables;
class DanaBosController extends Controller
{
public function index()
{
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$tagihan = tagihan::get();
$siswa = User::where('role', 'siswa')->get();
if (request()->ajax()) {
$query = Transaksi::with('jenistagihan')
->where('tagihan_id', '5')
->where('jurusan', $jurusan);
return DataTables::of($query)
->addColumn('action', function ($item) {
// $barcode = DNS1D::getBarcodeHTML($item->id, 'C128', 2, 50);
return '
<div class="btn-group">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle mr-1 mb-1" type="button" data-toggle="dropdown">Aksi</button>
<div class="dropdown-menu">
<button class="dropdown-item"
data-id="' . $item->id . '"
data-tagihan_id="' . $item->tagihan_id . '"
data-user_id="' . $item->user_id . '"
data-keterangan="' . $item->keterangan . '"
data-tgl_pembayaran="' . $item->tgl_pembayaran . '"
data-bukti_transaksi="' . $item->bukti_transaksi . '"
data-total="' . $item->total . '"
data-status="' . $item->status . '"
data-Pendapatan="' . $item->Pendapatan . '"
data-toggle="modal" data-target="#editModal">Edit</button>
<form action="' . route('data-tagihan-spp.destroy', $item->id) . '" method="POST">
' . method_field('delete') . csrf_field() . '
<button type="submit" class="dropdown-item text-danger">Hapus</button>
</form>
</div>
</div>
</div>
';
})
->addColumn('no', function ($item) {
static $counter = 1;
return $counter++;
})
->editColumn('bukti_transaksi', function ($item) {
// Cek apakah ada bukti pembayaran (gambar)
if ($item->bukti_transaksi) {
// Buat tautan dengan gambar sebagai isi
$image = '<img src="' . Storage::url($item->bukti_transaksi) . '" alt="Bukti Transaksi" style="width: 100px; height: auto;">';
$link = '<a href="' . Storage::url($item->bukti_transaksi) . '" data-lightbox="gallery">' . $image . '</a>';
return $link;
} else {
return ''; // Jika tidak ada bukti pembayaran, kembalikan string kosong
}
})
->addColumn('status', function ($item) {
switch ($item->status) {
case 0:
return '<span class="badge badge-warning">Menunggu Pembayaran</span>';
break;
case 1:
return '<span class="badge badge-info">Pending</span>';
break;
case 2:
return '<span class="badge badge-success">Sukses</span>';
break;
default:
return '<span class="badge badge-danger">Undefined</span>';
}
})
->rawColumns(['status', 'action', 'bukti_transaksi'])
->make(true);
}
return view('pages.data-pendapatan-danabos', compact('siswa', 'tagihan', 'trans', 'totaltransaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
$data = $request->all();
// Simpan data ke database
if ($request->hasFile('bukti_transaksi')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['bukti_transaksi'] = NULL;
}
Transaksi::create($data);
return redirect()->route('data-danabos.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
dd($e); // Menampilkan informasi exception ke terminal
return redirect()->route('data-danabos.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$item = Transaksi::findOrFail($id);
// Ambil data yang dikirimkan dalam request
$data = $request->all();
// Periksa apakah ada file yang diunggah
if ($request->hasFile('bukti_transaksi')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['bukti_transaksi'] = $item->bukti_transaksi;
}
// Lakukan pembaruan data transaksi dengan data yang baru
$item->update($data);
return redirect()->route('data-danabos.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Transaksi::findOrFail($id);
$data->delete();
return redirect()->route('data-danabos.index');
}
}

View File

@ -0,0 +1,91 @@
<?php
namespace App\Http\Controllers;
use App\Models\profile;
use Carbon\Carbon;
use App\Models\User;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
class DashboardController extends Controller
{
public function index()
{
$tanggalHariIni = Carbon::now()->timezone('Asia/Jakarta')->format('Y-m-d');
// dd($tanggalHariIni);
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$userid = Auth::user()->id;
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$pendapatanBulanan = Transaksi::select(
DB::raw('DATE_FORMAT(tgl_pembayaran, "%m") as bulan'),
DB::raw('SUM(total) as total_pendapatan')
)
->where('jenis_transaksi', 'Pendapatan')
->where('status', '2')
->groupBy('bulan')
->get();
$total = Transaksi::where('jenis_transaksi', 'Pendapatan')
->where('status', '2')
->where('jurusan', $jurusan)
->sum('total');
$totalpending = Transaksi::where('jenis_transaksi', 'Pendapatan')
->whereIn('status', ['0', '1']) // Menggunakan kondisi whereIn untuk status 0 atau 1
->where('jurusan', $jurusan)
->sum('total');
$pendapatan = Transaksi::where('jenis_transaksi', 'Pendapatan')
->where('tgl_pembayaran', $tanggalHariIni)
->where('tgl_pembayaran', $tanggalHariIni)
->where('jurusan', $jurusan)
->where('status', '2')
->sum('total');
// dd($pendapatan);
$pengeluaran = Transaksi::where('jenis_transaksi', 'Pengeluaran')
->where('jurusan', $jurusan)
->where('status', '2')
->sum('total');
$tagihanberjalan = Transaksi::where('user_id', $userid)
->where('status', '0')->count();
$tagihanpending = Transaksi::where('user_id', $userid)
->where('status', '1')->count();
$tagihanlunas = Transaksi::where('user_id', $userid)
->where('status', '2')->count();
$pendapatanbulan = Transaksi::where('jenis_transaksi', 'Pendapatan')
->where('jurusan', $jurusan)
->where('status', '2')
->sum('total');
// dd($pendapatan);
$pengeluaranbulan = Transaksi::where('jenis_transaksi', 'Pengeluaran')
->where('jurusan', $jurusan)
->sum('total');
$siswaexcellent = User::where('role', 'siswa')
->where('jurusan', 'excellent')->get()->count();
$siswareguler = User::where('role', 'siswa')
->where('jurusan', 'reguler')->get()->count();
$profile = profile::get();
return view('dashboard', compact('siswaexcellent', 'profile', 'siswareguler', 'pengeluaran', 'pengeluaranbulan', 'pendapatanbulan', 'pendapatan', 'totalpending', 'total', 'pendapatanBulanan', 'trans', 'totaltransaksi', 'tagihanberjalan', 'tagihanpending', 'tagihanlunas'));
// $pendapatan akan berisi nilai total pendapatan berdasarkan jenis_transaksi dan jurusan
}
}

View File

@ -0,0 +1,180 @@
<?php
namespace App\Http\Controllers;
use Carbon\Carbon;
use App\Models\User;
use App\Models\Cicilan;
use App\Models\tagihan;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class DetailsController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$user_id = $request->input('user_id');
$tagihan_id = $request->input('tagihan_id');
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
// Mengambil data user berdasarkan user_id
$user = User::findOrFail($user_id);
// Mengambil data tagihan berdasarkan tagihan_id
$tagihan = Tagihan::findOrFail($tagihan_id);
// $namatagihan = Tagihan::where('id', $tagihan_id);
// Mengambil transaksi berdasarkan user_id dan tagihan_id
$transaksi = Transaksi::with('user')
->where('tagihan_id', $tagihan_id)
->where('user_id', $user_id)
->get();
// Menghitung total transaksi berdasarkan user_id dan tagihan_id
$total = Transaksi::selectRaw('user_id, tagihan_id, SUM(total) as total_sum')
->where('tagihan_id', $tagihan_id)
->where('user_id', $user_id)
->groupBy('user_id', 'tagihan_id')
->first();
// Menghitung total cicilan berdasarkan user_id dan tagihan_id
$totalcicilan = Cicilan::selectRaw('user_id, tagihan_id, SUM(total) as total_sum')
->where('tagihan_id', $tagihan_id)
->where('user_id', $user_id)
->groupBy('user_id', 'tagihan_id')
->get();
// Mengambil data cicilan berdasarkan user_id dan tagihan_id tertentu
$cicilan = Cicilan::where('tagihan_id', $tagihan_id)
->where('user_id', $user_id)
->get();
$no = 1; // Ini mungkin untuk nomor urut, sesuaikan dengan kebutuhan
return view('pages.detail.detail', compact('user_id', 'tagihan_id', 'no', 'user', 'tagihan', 'transaksi', 'total', 'totalcicilan', 'cicilan', 'trans', 'totaltransaksi', 'tagihan'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
$request->validate([
'total' => 'required|numeric|min:0',
'bukti_pembayaran' => 'required|file|mimes:jpg,jpeg,png,pdf|max:2048',
]);
// Simpan data ke database
$data = $request->all();
$data['bukti_pembayaran'] = $request->file('bukti_pembayaran')->store('assets/bukti_transaksi', 'public');
$data['tgl'] = Carbon::now();
$cicilan = Cicilan::create($data);
$user_id = $data['user_id'];
$tagihan_id = $data['tagihan_id'];
$tgl = $data['tgl'] = Carbon::now();
$this->updateTransaksiStatus($cicilan, $tgl);
// Redirect dengan menyertakan user_id dan tagihan_id sebagai parameter
return redirect()->route('Details.index', compact('user_id', 'tagihan_id'))
->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
$data = $request->all();
$user_id = $data['user_id'];
$tagihan_id = $data['tagihan_id'];
$tgl = $request['tgl'];
return redirect()->route('Details.index', compact('user_id', 'tagihan_id'))->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
private function updateTransaksiStatus($cicilan, $tgl)
{
$tagihanId = $cicilan->tagihan_id;
$userId = $cicilan->user_id;
// Hitung total cicilan untuk tagihan_id dan user_id yang sama
$totalCicilan = Cicilan::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->sum('total');
// Hitung total transaksi untuk tagihan_id dan user_id yang sama
$totalTransaksi = Transaksi::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->sum('total');
// Periksa apakah total cicilan mencapai atau melebihi total transaksi
if ($totalCicilan >= $totalTransaksi) {
// Update status transaksi menjadi 'LUNAS'
Transaksi::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->update(['status' => '2', 'tgl_pembayaran' => $tgl]);
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request)
{
// Validasi request
// Dapatkan data dari request
$user_id = $request->input('user_id');
$tagihan_id = $request->input('tagihan_id');
$status = $request->input('status');
// Update semua transaksi berdasarkan user_id dan tagihan_id
Transaksi::where('user_id', $user_id)
->where('tagihan_id', $tagihan_id)
->update(['status' => $status]);
// Redirect atau berikan respon sesuai kebutuhan
return redirect()->route('Details.index', ['user_id' => $user_id, 'tagihan_id' => $tagihan_id])
->with('success', 'Status pembayaran telah diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Yajra\DataTables\Facades\DataTables;
class GuruController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$user = User::where('role', 'admin')->get();
return view('pages.data-guru', compact(
'user',
'no'
));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke database
User::create($request->all());
return redirect()->route('guru.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('guru.index')->with('error', 'Key yang anda masukkan tidak ada di saldo mon');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$data = $request->all();
$item = User::findOrFail($id);
$item->update($data);
return redirect()->route('guru.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = User::findOrFail($id);
$data->delete();
return redirect()->route('guru.index');
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
return view('home');
}
}

View File

@ -0,0 +1,102 @@
<?php
namespace App\Http\Controllers;
use App\Models\tagihan;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class JenisTagihanController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$tagihan = tagihan::whereNotIn('id', [1, 2, 3, 4, 5, 6])->get();
return view('pages.data-jenis-tagihan', compact(
'tagihan',
'no',
'trans',
'totaltransaksi',
));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke database
tagihan::create($request->all());
return redirect()->route('data-jenis-tagihan.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('data-jenis-tagihan.index')->with('error', 'Key yang anda masukkan tidak ada di saldo mon');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$data = $request->all();
$item = tagihan::findOrFail($id);
$item->update($data);
return redirect()->route('data-jenis-tagihan.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = tagihan::findOrFail($id);
$data->delete();
return redirect()->route('data-jenis-tagihan.index');
}
}

View File

@ -0,0 +1,125 @@
<?php
namespace App\Http\Controllers;
use Carbon\Carbon;
use App\Models\Transaksi;
use App\Exports\DataExport;
use Illuminate\Http\Request;
use App\Exports\LaporanExport;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Facades\Excel;
class LaporanKeuanganController extends Controller
{
public function index(Request $request)
{
// Ambil nilai bulan dan tahun dari request
$bulan = $request->input('bulan'); // Misalnya, parameter 'bulan' diambil dari URL atau form
$tahun = $request->input('tahun');
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$no = 1;
$transactions = Transaksi::select(
DB::raw('CASE
WHEN transaksi.tagihan_id = 6 THEN CONCAT(jenistagihan.name, " (", transaksi.keterangan, ")")
ELSE jenistagihan.name
END AS nama_tagihan'),
'transaksi.tagihan_id',
'transaksi.jenis_transaksi',
DB::raw('SUM(transaksi.total) AS jumlah')
)
->leftJoin('jenistagihan', 'transaksi.tagihan_id', '=', 'jenistagihan.id')
->where('transaksi.status', '2')
->where('transaksi.jurusan', $jurusan)
->whereYear('transaksi.tgl_pembayaran', $tahun) // Filter berdasarkan tahun
->whereMonth('transaksi.tgl_pembayaran', $bulan)
->groupBy('transaksi.tagihan_id', 'nama_tagihan', 'transaksi.jenis_transaksi')
->get();
$totalsaldo = Transaksi::where('status', '2')
->where('jenis_transaksi', 'pendapatan')
->whereYear('tgl_pembayaran', $tahun) // Filter berdasarkan tahun
->whereMonth('tgl_pembayaran', $bulan)
->sum('total');
$totalpengeluaran = Transaksi::where('status', '2')
->where('jenis_transaksi', 'pengeluaran')
->whereYear('tgl_pembayaran', $tahun) // Filter berdasarkan tahun
->whereMonth('tgl_pembayaran', $bulan)
->sum('total');
// ->get();
$listbulan = [
'1' => 'Januari',
'2' => 'Februari',
'3' => 'Maret',
'4' => 'April',
'5' => 'Mei',
'6' => 'Juni',
'7' => 'Juli',
'8' => 'Agustus',
'9' => 'September',
'10' => 'Oktober',
'11' => 'November',
'12' => 'Desember',
];
return view('pages.data-transaksi', compact('listbulan', 'totalsaldo', 'transactions', 'no', 'trans', 'totaltransaksi', 'bulan', 'tahun', 'totalpengeluaran'));
}
public function exportData(Request $request)
{
Carbon::setLocale('id');
$bulan = $request->query('bulan'); // Ambil nilai bulan dari query string
$tahun = $request->query('tahun');
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
// Contoh query untuk mengambil data yang ingin diekspor
$transactions = Transaksi::select(
DB::raw('CASE
WHEN transaksi.tagihan_id = 6 THEN CONCAT(jenistagihan.name, " (", transaksi.keterangan, ")")
ELSE jenistagihan.name
END AS nama_tagihan'),
'transaksi.tagihan_id',
'transaksi.jenis_transaksi',
DB::raw('SUM(transaksi.total) AS jumlah')
)
->leftJoin('jenistagihan', 'transaksi.tagihan_id', '=', 'jenistagihan.id')
->where('transaksi.status', '2')
->where('transaksi.jurusan', $jurusan)
->whereYear('transaksi.tgl_pembayaran', $tahun) // Filter berdasarkan tahun
->whereMonth('transaksi.tgl_pembayaran', $bulan)
->groupBy('transaksi.tagihan_id', 'nama_tagihan', 'transaksi.jenis_transaksi')
->get();
$totalsaldo = Transaksi::where('status', '2')
->where('jenis_transaksi', 'pendapatan')
->whereYear('tgl_pembayaran', $tahun) // Filter berdasarkan tahun
->whereMonth('tgl_pembayaran', $bulan)
->sum('total');
$totalpengeluaran = Transaksi::where('status', '2')
->where('jenis_transaksi', 'pengeluaran')
->whereYear('tgl_pembayaran', $tahun) // Filter berdasarkan tahun
->whereMonth('tgl_pembayaran', $bulan)
->sum('total');
// dd($bulan);
// Panggil class ekspor (ganti dengan nama class export yang sesuai)
$namaFile = 'laporanKeuangan_' . $tahun . '_' . Carbon::createFromFormat('m', $bulan)->translatedFormat('F') . '.xlsx';
return Excel::download(new LaporanExport($transactions, $totalsaldo, $bulan, $tahun, $totalpengeluaran), $namaFile);
}
}

View File

@ -0,0 +1,163 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Transaksi;
use App\Models\TahunAjaran;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Yajra\DataTables\Facades\DataTables;
class PembayaranDaftarUlangController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$tagihan = tagihan::get();
$tahun = TahunAjaran::where('status', 'aktif')->get();
$siswa = User::where('role', 'siswa')
->where('jurusan', $jurusan)
->get();
if (request()->ajax()) {
$query = Transaksi::select(
'transaksi.user_id',
'transaksi.tagihan_id',
'transaksi.status',
'users.name',
'users.kelas',
DB::raw('SUM(transaksi.total) as total_sum') // Memilih kolom total_sum sebagai hasil SUM
)
->join('users', 'transaksi.user_id', '=', 'users.id')
->where('transaksi.tagihan_id', '2')
->where('transaksi.jurusan', $jurusan)
->groupBy('transaksi.user_id', 'transaksi.tagihan_id', 'transaksi.status'); // Tambahkan kolom GROUP BY untuk kolom yang dipilih
return DataTables::of($query)
->addColumn('action', function ($item) {
return '<a href="' . route('Details.index', ['user_id' => $item->user_id, 'tagihan_id' => $item->tagihan_id]) . '" class="btn btn-primary">Detail</a>';
})
->addColumn('no', function ($item) {
static $counter = 1;
return $counter++;
})
->addColumn('status', function ($item) {
// Menggunakan switch-case untuk menampilkan label status berdasarkan nilai status
switch ($item->status) {
case 0:
return '<span class="badge badge-warning">Menunggu Pembayaran</span>';
case 1:
return '<span class="badge badge-info">Pending</span>';
case 2:
return '<span class="badge badge-success">Sukses</span>';
default:
return '<span class="badge badge-danger">Undefined</span>';
}
})
->rawColumns(['status', 'action'])
->make(true);
}
return view('pages.data-pembayaran-daftarulang', compact('siswa', 'tagihan', 'tahun', 'trans', 'totaltransaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke dalam database
foreach ($request['keterangan'] as $index => $keterangan) {
$nominal = (string) $request['total'][$index];
// Simpan ke database sesuai kebutuhan Anda
Transaksi::create([
'user_id' => $request['user_id'],
'tagihan_id' => $request['tagihan_id'],
'jurusan' => $request['jurusan'],
'jenis_transaksi' => $request['jenis_transaksi'],
'status' => $request['status'],
'date_awal' => $request['date_awal'],
'date_akhir' => $request['date_akhir'],
'tahunajar' => $request['tahunajar'],
'keterangan' => (string) $keterangan,
'total' => $nominal,
]);
}
// Simpan data ke database
// Transaksi::create($request->all());
return redirect()->route('data-tagihan-DaftarUlang.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
dd($e); // Menampilkan informasi exception ke terminal
return redirect()->route('data-tagihan-DaftarUlang.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$data = $request->all();
$item = Transaksi::findOrFail($id);
$item->update($data);
return redirect()->route('data-tagihan-DaftarUlang.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Transaksi::findOrFail($id);
$data->delete();
return redirect()->route('data-tagihan-DaftarUlang.index');
}
}

View File

@ -0,0 +1,173 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Transaksi;
use App\Models\TahunAjaran;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Yajra\DataTables\Facades\DataTables;
class PembayaranKainSeragamController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$tagihan = tagihan::get();
$siswa = User::where('role', 'siswa')
->where('jurusan', $jurusan)
->get();
$tahun = TahunAjaran::where('status', 'aktif')->get();
if (request()->ajax()) {
$query = Transaksi::select(
'transaksi.user_id',
'transaksi.tagihan_id',
'transaksi.status',
'users.name',
'users.kelas',
DB::raw('SUM(transaksi.total) as total_sum') // Memilih kolom total_sum sebagai hasil SUM
)
->join('users', 'transaksi.user_id', '=', 'users.id')
->where('transaksi.tagihan_id', '4')
->where('transaksi.jurusan', $jurusan)
->groupBy('transaksi.user_id', 'transaksi.tagihan_id', 'transaksi.status'); //
return DataTables::of($query)
->addColumn('action', function ($item) {
return '<a href="' . route('Details.index', ['user_id' => $item->user_id, 'tagihan_id' => $item->tagihan_id]) . '" class="btn btn-primary">Detail</a>';
})
->addColumn('no', function ($item) {
static $counter = 1;
return $counter++;
})
->addColumn('status', function ($item) {
switch ($item->status) {
case 0:
return '<span class="badge badge-warning">Menunggu Pembayaran</span>';
break;
case 1:
return '<span class="badge badge-info">Pending</span>';
break;
case 2:
return '<span class="badge badge-success">Sukses</span>';
break;
default:
return '<span class="badge badge-danger">Undefined</span>';
}
})
->rawColumns(['status', 'action'])
->make(true);
}
return view('pages.data-pembayaran-kainseragam', compact('siswa', 'tagihan', 'totaltransaksi', 'trans', 'tahun'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
foreach ($request['keterangan'] as $index => $keterangan) {
$nominal = (string) $request['total'][$index];
// Simpan ke database sesuai kebutuhan Anda
Transaksi::create([
'user_id' => $request['user_id'],
'tagihan_id' => $request['tagihan_id'],
'jurusan' => $request['jurusan'],
'jenis_transaksi' => $request['jenis_transaksi'],
'status' => $request['status'],
'date_awal' => $request['date_awal'],
'date_akhir' => $request['date_akhir'],
'tahunajar' => $request['tahunajar'],
'keterangan' => (string) $keterangan,
'total' => $nominal,
]);
}
return redirect()->route('data-tagihan-kainSeragam.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
dd($e); // Menampilkan informasi exception ke terminal
return redirect()->route('data-tagihan-kainSeragam.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$item = Transaksi::findOrFail($id);
// Ambil data yang dikirimkan dalam request
$data = $request->all();
// Periksa apakah ada file yang diunggah
if ($request->hasFile('bukti_transaksi')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['bukti_transaksi'] = $item->bukti_transaksi;
}
// Lakukan pembaruan data transaksi dengan data yang baru
$item->update($data);
return redirect()->route('data-tagihan-kainSeragam.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Transaksi::findOrFail($id);
$data->delete();
return redirect()->route('data-tagihan-kainSeragam.index');
}
}

View File

@ -0,0 +1,214 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Yajra\DataTables\Facades\DataTables;
class PembayaranLainnyaController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$tagihan = tagihan::get();
$siswa = User::where('role', 'siswa')
->where('jurusan', $jurusan)
->get();
if (request()->ajax()) {
$query = Transaksi::with('user')
->where('tagihan_id', '6')
->where('jurusan', $jurusan)
->whereDoesntHave('user', function ($query) {
$query->whereIn('role', ['bendahara-excellent', 'bendahara-reguler']);
});
return DataTables::of($query)
->addColumn('action', function ($item) {
$editButton = '
<button class="dropdown-item"
data-id="' . $item->id . '"
data-tagihan_id="' . $item->tagihan_id . '"
data-user_id="' . $item->user_id . '"
data-keterangan="' . $item->keterangan . '"
data-date_awal="' . $item->date_awal . '"
data-date_akhir="' . $item->date_akhir . '"
data-metode="' . $item->metode . '"
data-total="' . $item->total . '"
data-status="' . $item->status . '"
data-jurusan="' . $item->jurusan . '"
data-Pendapatan="' . $item->Pendapatan . '"
data-toggle="modal" data-target="#editModal">Edit</button>';
$deleteForm = '
<form action="' . route('data-tagihan-spp.destroy', $item->id) . '" method="POST">
' . method_field('delete') . csrf_field() . '
<button type="submit" class="dropdown-item text-danger">Hapus</button>
</form>';
$lunasButton = '';
if ($item->status != 2) {
$lunasButton = '
<form action="' . route('data-tagihan-spp.update', $item->id) . '" method="POST" class="d-inline">
' . method_field('PUT') . csrf_field() . '
<input type="hidden" name="id" value="' . $item->id . '">
<input type="hidden" name="user_id" value="' . $item->user_id . '">
<input type="hidden" name="tagihan_id" value="' . $item->tagihan_id . '">
<input type="hidden" name="status" value="2">
<button type="submit" class="btn btn-success">Lunas</button>
</form>';
}
return '
<div class="btn-group">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle mr-1 mb-1" type="button" data-toggle="dropdown">Aksi</button>
<div class="dropdown-menu">
' . $editButton . '
' . $deleteForm . '
</div>
</div>
' . $lunasButton . '
</div>';
})
->addColumn('no', function ($item) {
static $counter = 1;
return $counter++;
})
->addColumn('bukti_transaksi', function ($item) {
if ($item->bukti_transaksi) {
// Jika ada data bukti transaksi, tampilkan tautan dan gambar
return '<td><a href="' . Storage::url($item->bukti_transaksi) . '" data-lightbox="gallery">
<img src="' . Storage::url($item->bukti_transaksi) . '" alt="Bukti Transaksi" style="width: 100px; height: auto;">
</a></td>';
} else {
// Jika tidak ada data bukti transaksi, tampilkan tanda strip (-)
return '<td>-</td>';
}
})
->addColumn('status', function ($item) {
switch ($item->status) {
case 0:
return '<span class="badge badge-warning">Menunggu Pembayaran</span>';
break;
case 1:
return '<span class="badge badge-info">Pending</span>';
break;
case 2:
return '<span class="badge badge-success">Sukses</span>';
break;
default:
return '<span class="badge badge-danger">Undefined</span>';
}
})
->rawColumns(['status', 'bukti_transaksi', 'action'])
->make(true);
}
return view('pages.data-pembayaran-lainnya', compact('siswa', 'tagihan', 'trans', 'totaltransaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
$data = $request->all();
// Simpan data ke database
if ($request->hasFile('bukti_transaksi')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['bukti_transaksi'] = NULL;
}
Transaksi::create($data);
return redirect()->route('data-tagihan-lainnya.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
dd($e); // Menampilkan informasi exception ke terminal
return redirect()->route('data-tagihan-lainnya.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$item = Transaksi::findOrFail($id);
// Ambil data yang dikirimkan dalam request
$data = $request->all();
// Periksa apakah ada file yang diunggah
if ($request->hasFile('bukti_transaksi')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['bukti_transaksi'] = $item->bukti_transaksi;
}
// Lakukan pembaruan data transaksi dengan data yang baru
$item->update($data);
return redirect()->route('data-tagihan-lainnya.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Transaksi::findOrFail($id);
$data->delete();
return redirect()->route('data-tagihan-lainnya.index');
}
}

View File

@ -0,0 +1,180 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Cicilan;
use App\Models\tagihan;
use App\Models\TahunAjaran;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Yajra\DataTables\Facades\DataTables;
class PembayaranPendaftaranController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$tagihan = tagihan::get();
$siswa = User::where('role', 'siswa')
->where('jurusan', $jurusan)
->get();
$tahun = TahunAjaran::where('status', 'aktif')->get();
if (request()->ajax()) {
$query = Transaksi::select(
'transaksi.user_id',
'transaksi.tagihan_id',
'transaksi.status',
'users.name',
'users.kelas',
DB::raw('SUM(transaksi.total) as total_sum') // Memilih kolom total_sum sebagai hasil SUM
)
->join('users', 'transaksi.user_id', '=', 'users.id')
->where('transaksi.tagihan_id', '3')
->where('transaksi.jurusan', $jurusan)
->groupBy('transaksi.user_id', 'transaksi.tagihan_id', 'transaksi.status'); // Tambahkan kolom GROUP BY untuk kolom yang dipilih
return DataTables::of($query)
->addColumn('action', function ($item) {
return '
<div>
<a href="' . route('Details.index', ['user_id' => $item->user_id, 'tagihan_id' => $item->tagihan_id]) . '" class="btn btn-primary">Detail</a>
</div>
';
})
->addColumn('no', function ($item) {
static $counter = 1;
return $counter++;
})
->addColumn('status', function ($item) {
// Menggunakan switch-case untuk menampilkan label status berdasarkan nilai status
switch ($item->status) {
case 0:
return '<span class="badge badge-warning">Menunggu Pembayaran</span>';
case 1:
return '<span class="badge badge-info">Pending</span>';
case 2:
return '<span class="badge badge-success">Sukses</span>';
default:
return '<span class="badge badge-danger">Undefined</span>';
}
})
->rawColumns(['status', 'action'])
->make(true);
}
return view('pages.data-pembayaran-pendaftaran', compact('siswa', 'tagihan', 'tahun', 'trans', 'totaltransaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke dalam database
foreach ($request['keterangan'] as $index => $keterangan) {
$nominal = (string) $request['total'][$index];
// Simpan ke database sesuai kebutuhan Anda
Transaksi::create([
'user_id' => $request['user_id'],
'tagihan_id' => $request['tagihan_id'],
'jurusan' => $request['jurusan'],
'jenis_transaksi' => $request['jenis_transaksi'],
'status' => $request['status'],
'date_awal' => $request['date_awal'],
'date_akhir' => $request['date_akhir'],
'tahunajar' => $request['tahunajar'],
'keterangan' => (string) $keterangan,
'total' => $nominal,
]);
}
// Simpan data ke database
// Transaksi::create($request->all());
return redirect()->route('data-tagihan-Pendaftaran.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
dd($e); // Menampilkan informasi exception ke terminal
return redirect()->route('data-tagihan-Pendaftaran.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$item = Transaksi::findOrFail($id);
// Ambil data yang dikirimkan dalam request
$data = $request->all();
// Periksa apakah ada file yang diunggah
if ($request->hasFile('bukti_transaksi')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['bukti_transaksi'] = $item->bukti_transaksi;
}
// Lakukan pembaruan data transaksi dengan data yang baru
$item->update($data);
return redirect()->route('data-tagihan-Pendaftaran.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Transaksi::findOrFail($id);
$data->delete();
return redirect()->route('data-tagihan-Pendaftaran.index');
}
}

View File

@ -0,0 +1,253 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Transaksi;
use App\Models\TahunAjaran;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Yajra\DataTables\Facades\DataTables;
class PembayaranSppController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$tagihan = tagihan::get();
$tahun = TahunAjaran::where('status', 'Aktif')->get();
$siswa = User::where('role', 'siswa')
->where('jurusan', $jurusan)
->get();
if (request()->ajax()) {
$query = Transaksi::with('user')
->where('tagihan_id', '1')
->where('jurusan', $jurusan);
return DataTables::of($query)
->addColumn('action', function ($item) {
$editButton = '
<button class="dropdown-item"
data-id="' . $item->id . '"
data-tagihan_id="' . $item->tagihan_id . '"
data-user_id="' . $item->user_id . '"
data-keterangan="' . $item->keterangan . '"
data-date_awal="' . $item->date_awal . '"
data-date_akhir="' . $item->date_akhir . '"
data-metode="' . $item->metode . '"
data-total="' . $item->total . '"
data-status="' . $item->status . '"
data-jurusan="' . $item->jurusan . '"
data-Pendapatan="' . $item->Pendapatan . '"
data-toggle="modal" data-target="#editModal">Edit</button>';
$deleteForm = '
<form action="' . route('data-tagihan-spp.destroy', $item->id) . '" method="POST">
' . method_field('delete') . csrf_field() . '
<button type="submit" class="dropdown-item text-danger">Hapus</button>
</form>';
$lunasButton = '';
if ($item->status != 2) {
$lunasButton = '
<form action="' . route('data-tagihan-spp.update', $item->id) . '" method="POST" class="d-inline">
' . method_field('PUT') . csrf_field() . '
<input type="hidden" name="id" value="' . $item->id . '">
<input type="hidden" name="user_id" value="' . $item->user_id . '">
<input type="hidden" name="tagihan_id" value="' . $item->tagihan_id . '">
<input type="hidden" name="status" value="2">
<button type="submit" class="btn btn-success">Lunas</button>
</form>';
}
return '
<div class="btn-group">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle mr-1 mb-1" type="button" data-toggle="dropdown">Aksi</button>
<div class="dropdown-menu">
' . $editButton . '
' . $deleteForm . '
</div>
</div>
' . $lunasButton . '
</div>';
})
->addColumn('no', function ($item) {
static $counter = 1;
return $counter++;
})
->addColumn('status', function ($item) {
switch ($item->status) {
case 0:
return '<span class="badge badge-warning">Menunggu Pembayaran</span>';
break;
case 1:
return '<span class="badge badge-info">Pending</span>';
break;
case 2:
return '<span class="badge badge-success">Sukses</span>';
break;
default:
return '<span class="badge badge-danger">Undefined</span>';
}
})
->addColumn('bukti_transaksi', function ($item) {
if ($item->bukti_transaksi) {
// Jika ada data bukti transaksi, tampilkan tautan dan gambar
return '<td><a href="' . Storage::url($item->bukti_transaksi) . '" data-lightbox="gallery">
<img src="' . Storage::url($item->bukti_transaksi) . '" alt="Bukti Transaksi" style="width: 100px; height: auto;">
</a></td>';
} else {
// Jika tidak ada data bukti transaksi, tampilkan tanda strip (-)
return '<td>-</td>';
}
})
->rawColumns(['status', 'bukti_transaksi', 'tahun', 'action'])
->make(true);
}
return view('pages.data-pembayaran-spp', compact('siswa', 'tagihan', 'tahun', 'trans', 'totaltransaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
// dd($request['tahunajar']);
try {
if ($request->has('kelas')) {
// Jika request memiliki parameter 'kelas', ambil pengguna (user) berdasarkan kelas
$users = User::where('kelas', $request['kelas'])->get();
// Iterasi setiap pengguna (user) dalam kelas tertentu
foreach ($users as $user) {
foreach ($request['keterangan'] as $index => $keterangan) {
$nominal = (string) $request['total'][$index];
// Siapkan data transaksi untuk ditambahkan ke tabel 'transaksi'
$data = [
'user_id' => $user->id,
'tagihan_id' => $request['tagihan_id'],
'keterangan' => (string) $keterangan,
'jenis_transaksi' => $request['jenis_transaksi'],
'jurusan' => $request['jurusan'],
'total' => $nominal, // Misalnya, total pembayaran SPP
'date_awal' => $request['date_awal'], // Misalnya, total pembayaran SPP
'date_akhir' => $request['date_akhir'], // Misalnya, total pembayaran SPP
'tahunajar' => $request['tahunajar'], // Misalnya, total pembayaran SPP
'status' => '0', // Status "Belum Dibayar"
];
// Tambahkan data transaksi ke dalam tabel 'transaksi'
Transaksi::create($data);
}
}
} else {
// Jika tidak ada parameter 'kelas', tambahkan data transaksi berdasarkan request
foreach ($request['keterangan'] as $index => $keterangan) {
$nominal = (string) $request['total'][$index];
// Simpan ke database sesuai kebutuhan Anda
Transaksi::create([
'user_id' => $request['user_id'],
'tagihan_id' => $request['tagihan_id'],
'jurusan' => $request['jurusan'],
'jenis_transaksi' => $request['jenis_transaksi'],
'status' => $request['status'],
'date_awal' => $request['date_awal'],
'date_akhir' => $request['date_akhir'],
'tahunajar' => $request['tahunajar'],
'keterangan' => (string) $keterangan,
'total' => $nominal,
]);
}
}
return redirect()->route('data-tagihan-spp.index')->with('success', 'Data berhasil ditambah.');
} catch (\Exception $e) {
dd($e);
return redirect()->route('data-tagihan-spp.index')->with('error', 'Data gagal ditambah.');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
// Temukan transaksi berdasarkan ID atau tampilkan error jika tidak ditemukan
$item = Transaksi::findOrFail($id);
// Ambil data yang dikirimkan dalam request
// Periksa apakah ada file yang diunggah
if ($request->hasFile('bukti_transaksi')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['bukti_transaksi'] = $item->bukti_transaksi;
}
$data = $request->all();
// Lakukan pembaruan data transaksi dengan data yang baru
$item->update($data);
return redirect()->route('data-tagihan-spp.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Transaksi::findOrFail($id);
$data->delete();
return redirect()->route('data-tagihan-spp.index');
}
}

View File

@ -0,0 +1,187 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Yajra\DataTables\Facades\DataTables;
class PendapatanController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$tagihan = tagihan::get();
$siswa = User::where('role', 'siswa')->get();
if (request()->ajax()) {
$query = Transaksi::with('jenistagihan')
->where('jenis_transaksi', 'Pendapatan') // Memfilter berdasarkan tagihan_id = 1
->where('jurusan', $jurusan)
->where('status', '2');
return DataTables::of($query)
->addColumn('action', function ($item) {
// $barcode = DNS1D::getBarcodeHTML($item->id, 'C128', 2, 50);
return '
<div class="btn-group">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle mr-1 mb-1" type="button" data-toggle="dropdown">Aksi</button>
<div class="dropdown-menu">
<button class="dropdown-item"
data-id="' . $item->id . '"
data-tagihan_id="' . $item->tagihan_id . '"
data-user_id="' . $item->user_id . '"
data-keterangan="' . $item->keterangan . '"
data-tgl_pembayaran="' . $item->tgl_pembayaran . '"
data-total="' . $item->total . '"
data-status="' . $item->status . '"
data-Pendapatan="' . $item->Pendapatan . '"
data-toggle="modal" data-target="#editModal">Edit</button>
<form action="' . route('data-pendapatan.destroy', $item->id) . '" method="POST">
' . method_field('delete') . csrf_field() . '
<button type="submit" class="dropdown-item text-danger">Hapus</button>
</form>
</div>
</div>
</div>
';
})
->addColumn('no', function ($item) {
static $counter = 1;
return $counter++;
})
->editColumn('bukti_transaksi', function ($item) {
// Cek apakah ada bukti pembayaran (gambar)
if ($item->bukti_transaksi) {
// Buat tautan dengan gambar sebagai isi
$image = '<img src="' . Storage::url($item->bukti_transaksi) . '" alt="Bukti Transaksi" style="width: 100px; height: auto;">';
$link = '<a href="' . Storage::url($item->bukti_transaksi) . '" data-lightbox="gallery">' . $image . '</a>';
return $link;
} else {
return ''; // Jika tidak ada bukti pembayaran, kembalikan string kosong
}
})
->addColumn('status', function ($item) {
switch ($item->status) {
case 0:
return '<span class="badge badge-warning">Menunggu Pembayaran</span>';
break;
case 1:
return '<span class="badge badge-info">Pending</span>';
break;
case 2:
return '<span class="badge badge-success">Sukses</span>';
break;
default:
return '<span class="badge badge-danger">Undefined</span>';
}
})
->rawColumns(['status', 'action', 'bukti_transaksi'])
->make(true);
}
return view('pages.data-pendapatan', compact('siswa', 'tagihan', 'trans', 'totaltransaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
$data = $request->all();
// Simpan data ke database
if ($request->hasFile('bukti_transaksi')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['bukti_transaksi'] = NULL;
}
Transaksi::create($data);
return redirect()->route('data-pendapatan.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
dd($e); // Menampilkan informasi exception ke terminal
return redirect()->route('data-pendapatan.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$item = Transaksi::findOrFail($id);
// Ambil data yang dikirimkan dalam request
$data = $request->all();
// Periksa apakah ada file yang diunggah
if ($request->hasFile('bukti_transaksi')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['bukti_transaksi'] = $item->bukti_transaksi;
}
// Lakukan pembaruan data transaksi dengan data yang baru
$item->update($data);
return redirect()->back()->with('success', 'Update Data successfully.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Transaksi::findOrFail($id);
$data->delete();
return redirect()->back()->with('success', 'Delete Data successfully.');
}
}

View File

@ -0,0 +1,188 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Yajra\DataTables\Facades\DataTables;
class PengeluaranController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$tagihan = tagihan::whereNotIn('id', [1, 2, 3, 4, 5, 6])->get();
$siswa = User::where('role', 'siswa')->get();
if (request()->ajax()) {
$query = Transaksi::with('jenistagihan')
->where('jenis_transaksi', 'Pengeluaran') // Memfilter berdasarkan tagihan_id = 1
->where('jurusan', $jurusan)
->where('status', '2');
return DataTables::of($query)
->addColumn('action', function ($item) {
// $barcode = DNS1D::getBarcodeHTML($item->id, 'C128', 2, 50);
return '
<div class="btn-group">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle mr-1 mb-1" type="button" data-toggle="dropdown">Aksi</button>
<div class="dropdown-menu">
<button class="dropdown-item"
data-id="' . $item->id . '"
data-tagihan_id="' . $item->tagihan_id . '"
data-user_id="' . $item->user_id . '"
data-keterangan="' . $item->keterangan . '"
data-tgl_pembayaran="' . $item->tgl_pembayaran . '"
data-total="' . $item->total . '"
data-status="' . $item->status . '"
data-Pendapatan="' . $item->Pendapatan . '"
data-toggle="modal" data-target="#editModal">Edit</button>
<form action="' . route('data-pengeluaran.destroy', $item->id) . '" method="POST">
' . method_field('delete') . csrf_field() . '
<button type="submit" class="dropdown-item text-danger">Hapus</button>
</form>
</div>
</div>
</div>
';
})
->addColumn('no', function ($item) {
static $counter = 1;
return $counter++;
})
->editColumn('bukti_transaksi', function ($item) {
// Cek apakah ada bukti pembayaran (gambar)
if ($item->bukti_transaksi) {
// Buat tautan dengan gambar sebagai isi
$image = '<img src="' . Storage::url($item->bukti_transaksi) . '" alt="Bukti Transaksi" style="width: 100px; height: auto;">';
$link = '<a href="' . Storage::url($item->bukti_transaksi) . '" data-lightbox="gallery">' . $image . '</a>';
return $link;
} else {
return ''; // Jika tidak ada bukti pembayaran, kembalikan string kosong
}
})
->addColumn('status', function ($item) {
switch ($item->status) {
case 0:
return '<span class="badge badge-warning">Menunggu Pembayaran</span>';
break;
case 1:
return '<span class="badge badge-info">Pending</span>';
break;
case 2:
return '<span class="badge badge-success">Sukses</span>';
break;
default:
return '<span class="badge badge-danger">Undefined</span>';
}
})
->rawColumns(['status', 'action', 'bukti_transaksi'])
->make(true);
}
return view('pages.data-pengeluaran', compact('siswa', 'tagihan', 'trans', 'totaltransaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
$data = $request->all();
// Simpan data ke database
if ($request->hasFile('bukti_transaksi')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['bukti_transaksi'] = NULL;
}
Transaksi::create($data);
return redirect()->route('data-pengeluaran.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
dd($e); // Menampilkan informasi exception ke terminal
return redirect()->route('data-pengeluaran.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$item = Transaksi::findOrFail($id);
// Ambil data yang dikirimkan dalam request
$data = $request->all();
// Periksa apakah ada file yang diunggah
if ($request->hasFile('bukti_transaksi')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['bukti_transaksi'] = $item->bukti_transaksi;
}
// Lakukan pembaruan data transaksi dengan data yang baru
$item->update($data);
return redirect()->route('data-pengeluaran.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Transaksi::findOrFail($id);
$data->delete();
return redirect()->route('data-pengeluaran.index');
}
}

View File

@ -0,0 +1,90 @@
<?php
namespace App\Http\Controllers;
use Carbon\Carbon;
use App\Models\User;
use Illuminate\View\View;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Redirect;
use App\Http\Requests\ProfileUpdateRequest;
use App\Models\Transaksi;
class ProfileController extends Controller
{
/**
* Display the user's profile form.
*/
public function index(Request $request): View
{
// Mendapatkan tanggal hari ini
// $today = Carbon::now()->toDateString();
$user = Auth::user();
if ($user->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
// Mengambil transaksi terbaru pada tanggal hari ini
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
return view('pages.edit-profile', compact('user', 'trans', 'totaltransaksi'));
}
/**
* Update the user's profile information.
*/
public function update(Request $request, $id)
{
try {
$item = User::findOrFail($id);
$data = $request->all();
if ($request->hasFile('foto')) {
// Jika ada file yang diunggah, simpan file baru dan gunakan path yang baru
$data['foto'] = $request->file('foto')->store('assets/foto', 'public');
} else {
// Jika tidak ada file yang diunggah, gunakan foto lama (path yang sudah ada)
$data['foto'] = $item->foto;
}
$item->update($data);
return redirect()->route('profile.index')->with('success', 'Data berhasil diperbarui.');
} catch (\Exception $e) {
return redirect()->back()->with('error', 'Terjadi kesalahan: ' . $e->getMessage());
}
}
/**
* Delete the user's account.
*/
public function destroy(Request $request): RedirectResponse
{
$request->validateWithBag('userDeletion', [
'password' => ['required', 'current_password'],
]);
$user = $request->user();
Auth::logout();
$user->delete();
$request->session()->invalidate();
$request->session()->regenerateToken();
return Redirect::to('/');
}
}

View File

@ -0,0 +1,136 @@
<?php
namespace App\Http\Controllers\Rekap;
use Carbon\Carbon;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Transaksi;
use App\Models\TahunAjaran;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Exports\RekapitulasiExport;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Facades\Excel;
class RekapitulasiPendapatanController extends Controller
{
public function index(Request $request)
{
$bulan = $request->query('bulan'); // Ambil nilai bulan dari query string
$selectedyear = $request->query('tahun');
$tagihanid = $request->query('tagihan_id');
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$no = 1;
$listbulan = [
'1' => 'Januari',
'2' => 'Februari',
'3' => 'Maret',
'4' => 'April',
'5' => 'Mei',
'6' => 'Juni',
'7' => 'Juli',
'8' => 'Agustus',
'9' => 'September',
'10' => 'Oktober',
'11' => 'November',
'12' => 'Desember',
];
$tagihan = tagihan::whereNotIn('id', ['5'])->get();
$siswa = User::where('role', 'siswa')->get();
$tahun = TahunAjaran::where('status', 'aktif')->get();
$query = Transaksi::select(
'jenistagihan.name as Namatagihan',
'transaksi.tagihan_id',
DB::raw('GROUP_CONCAT(transaksi.keterangan SEPARATOR ", ") as keterangan'),
DB::raw('SUM(transaksi.total) as total'),
DB::raw('MIN(transaksi.tgl_pembayaran) as tgl_pembayaran') // Menggunakan MIN untuk tanggal pembayaran pertama
)
->join('jenistagihan', 'jenistagihan.id', '=', 'transaksi.tagihan_id')
->where('jenis_transaksi', 'Pendapatan')
->where('jurusan', $jurusan);
if ($tagihanid) {
$query->where('tagihan_id', $tagihanid);
}
if ($selectedyear) {
$query->whereYear('tgl_pembayaran', $selectedyear);
}
if ($bulan) {
$query->whereMonth('tgl_pembayaran', $bulan);
}
if (Auth::user()->role == 'bendahara-excellent') {
$query->whereNotIn('tagihan_id', ['5']);
}
$query->groupBy('transaksi.tagihan_id');
$data = $query->get();
$jumlahtotal = $data->sum('total');
return view('pages.rekapitulasi.rekapitulasi-pendapatan', compact('siswa', 'tagihan', 'no', 'tahun', 'jumlahtotal', 'trans', 'data', 'totaltransaksi', 'listbulan', 'query'));
}
public function exportExcel(Request $request)
{
Carbon::setLocale('id');
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$tagihanid = $request->input('tagihan_id');
$tahun = $request->input('tahun');
$bulan = $request->input('bulan');
$query = Transaksi::select(
'jenistagihan.name as Namatagihan',
'transaksi.tagihan_id',
DB::raw('GROUP_CONCAT(transaksi.keterangan SEPARATOR ", ") as keterangan'),
DB::raw('SUM(transaksi.total) as total'),
DB::raw('MIN(transaksi.tgl_pembayaran) as tgl_pembayaran') // Menggunakan MIN untuk tanggal pembayaran pertama
)
->join('jenistagihan', 'jenistagihan.id', '=', 'transaksi.tagihan_id')
->where('jenis_transaksi', 'Pendapatan')
->where('jurusan', $jurusan);
if ($tagihanid) {
$query->where('tagihan_id', $tagihanid);
}
if ($tahun) {
$query->whereYear('tgl_pembayaran', $tahun);
}
if ($bulan) {
$query->whereMonth('tgl_pembayaran', $bulan);
}
if (Auth::user()->role == 'bendahara-excellent') {
$query->whereNotIn('tagihan_id', ['5']);
}
$query->groupBy('transaksi.tagihan_id');
$data = $query->get();
$jumlahtotal = $data->sum('total');
$title = 'Pendapatan';
// Buat nama file berdasarkan ketersediaan bulan dan tahun
if ($tahun && $bulan) {
$namaFile = 'Rekapitulasi-Pendapatan_' . $tahun . '_' . Carbon::createFromFormat('m', $bulan)->translatedFormat('F') . '.xlsx';
} elseif ($tahun) {
$namaFile = 'Rekapitulasi-Pendapatan_' . $tahun . '.xlsx';
} else {
$namaFile = 'Rekapitulasi-Pendapatan.xlsx';
}
return Excel::download(new RekapitulasiExport($data, $jumlahtotal, $title, $bulan, $tahun), $namaFile);
}
}

View File

@ -0,0 +1,132 @@
<?php
namespace App\Http\Controllers\Rekap;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Transaksi;
use App\Models\TahunAjaran;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Exports\RekapitulasiExport;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Facades\Excel;
use Yajra\DataTables\Facades\DataTables;
use Carbon\Carbon;
class RekapitulasiPengeluaranController extends Controller
{
public function index(Request $request)
{
$bulan = $request->query('bulan'); // Ambil nilai bulan dari query string
$selectedyear = $request->query('tahun');
$tagihanid = $request->query('tagihan_id');
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$no = 1;
$listbulan = [
'1' => 'Januari',
'2' => 'Februari',
'3' => 'Maret',
'4' => 'April',
'5' => 'Mei',
'6' => 'Juni',
'7' => 'Juli',
'8' => 'Agustus',
'9' => 'September',
'10' => 'Oktober',
'11' => 'November',
'12' => 'Desember',
];
$tagihan = tagihan::whereNotIn('id', [1, 2, 3, 4, 5, 6])->get();
$siswa = User::where('role', 'siswa')->get();
$tahun = TahunAjaran::where('status', 'aktif')->get();
$query = Transaksi::select(
'jenistagihan.name as Namatagihan',
'transaksi.tagihan_id',
DB::raw('GROUP_CONCAT(transaksi.keterangan SEPARATOR ", ") as keterangan'),
DB::raw('SUM(transaksi.total) as total'),
DB::raw('MIN(transaksi.tgl_pembayaran) as tgl_pembayaran') // Menggunakan MIN untuk tanggal pembayaran pertama
)
->join('jenistagihan', 'jenistagihan.id', '=', 'transaksi.tagihan_id')
->where('jenis_transaksi', 'Pengeluaran')
->where('jurusan', $jurusan);
if ($selectedyear) {
$query->whereYear('tgl_pembayaran', $selectedyear);
}
if ($bulan) {
$query->whereMonth('tgl_pembayaran', $bulan);
}
if (Auth::user()->role == 'bendahara-excellent') {
$query->whereNotIn('tagihan_id', ['5']);
}
$query->groupBy('transaksi.tagihan_id');
$data = $query->get();
$jumlahtotal = $data->sum('total');
return view('pages.rekapitulasi.rekapitulasi-pengeluaran', compact('siswa', 'tagihan', 'jumlahtotal', 'no', 'tahun', 'trans', 'data', 'totaltransaksi', 'listbulan', 'query'));
}
public function exportExcel(Request $request)
{
Carbon::setLocale('id');
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$tagihanid = $request->input('tagihan_id');
$tahun = $request->input('tahun');
$bulan = $request->input('bulan');
$query = Transaksi::select(
'jenistagihan.name as Namatagihan',
'transaksi.tagihan_id',
DB::raw('GROUP_CONCAT(transaksi.keterangan SEPARATOR ", ") as keterangan'),
DB::raw('SUM(transaksi.total) as total'),
DB::raw('MIN(transaksi.tgl_pembayaran) as tgl_pembayaran') // Menggunakan MIN untuk tanggal pembayaran pertama
)
->join('jenistagihan', 'jenistagihan.id', '=', 'transaksi.tagihan_id')
->where('jenis_transaksi', 'Pengeluaran')
->where('jurusan', $jurusan);
if ($tahun) {
$query->whereYear('tgl_pembayaran', $tahun);
}
if ($bulan) {
$query->whereMonth('tgl_pembayaran', $bulan);
}
if (Auth::user()->role == 'bendahara-excellent') {
$query->whereNotIn('tagihan_id', ['5']);
}
$query->groupBy('transaksi.tagihan_id');
$data = $query->get();
$jumlahtotal = $data->sum('total');
$title = 'Pengeluaran';
// Buat nama file berdasarkan ketersediaan bulan dan tahun
if ($tahun && $bulan) {
$namaFile = 'Rekapitulasi-Pengeluaran_' . $tahun . '_' . Carbon::createFromFormat('m', $bulan)->translatedFormat('F') . '.xlsx';
} elseif ($tahun) {
$namaFile = 'Rekapitulasi-Pengeluaran_' . $tahun . '.xlsx';
} else {
$namaFile = 'Rekapitulasi-Pengeluaran.xlsx';
}
return Excel::download(new RekapitulasiExport($data, $jumlahtotal, $title, $bulan, $tahun), $namaFile);
}
}

View File

@ -0,0 +1,150 @@
<?php
namespace App\Http\Controllers;
use App\Models\Rekening;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RekeningController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
if (Auth::user()->role == 'bendahara-excellent') {
$jurusan = 'excellent';
} elseif (Auth::user()->role == 'bendahara-reguler') {
$jurusan = 'reguler';
} else {
$jurusan = 'NULL';
}
$tagihan = Rekening::where('jurusan', $jurusan)->get();
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$namaBank = [
"Bank Central Asia (BCA)",
"Bank Rakyat Indonesia (BRI)",
"Bank Mandiri",
"Bank Negara Indonesia (BNI)",
"Bank Tabungan Negara (BTN)",
"Bank CIMB Niaga",
"Bank Danamon",
"Bank Permata",
"Bank Panin",
"Bank Syariah Indonesia (BSI)",
"Bank Mega",
"Bank OCBC NISP",
"Bank BTPN",
"Bank Bukopin",
"Bank Maybank Indonesia",
"Bank Jatim",
"Bank Jabar Banten (BJB)",
"Bank DKI",
"Bank Sumut",
"Bank Sumsel Babel",
"Bank BPD Bali",
"Bank Papua",
"Bank Sulselbar",
"Bank Kalbar",
"Bank Kalteng",
"Bank Nagari",
"Bank Aceh Syariah",
"Bank Lampung",
"Bank SulutGo",
"Bank Maluku Malut",
"Bank NTT",
"Bank NTB Syariah",
"Bank Kaltimtara",
"Bank Kalsel",
"Bank Riau Kepri",
"Bank Sulteng",
"Bank Bengkulu",
"Bank BPD DIY",
"Bank Jateng"
];
return view('pages.data-rekening', compact(
'tagihan',
'no',
'trans',
'totaltransaksi',
'jurusan',
'namaBank'
));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke database
Rekening::create($request->all());
return redirect()->route('data-rekening.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
dd($e);
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('data-rekening.index')->with('error', 'Key yang anda masukkan tidak ada di saldo mon');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$data = $request->all();
$item = Rekening::findOrFail($id);
$item->update($data);
return redirect()->route('data-rekening.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Rekening::findOrFail($id);
$data->delete();
return redirect()->route('data-rekening.index');
}
}

View File

@ -0,0 +1,147 @@
<?php
namespace App\Http\Controllers\Siswa;
use Carbon\Carbon;
use App\Models\User;
use App\Models\Cicilan;
use App\Models\tagihan;
use App\Models\Rekening;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
class PembayaranDaftarUlangController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$user = Auth::id();
$no = 1;
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('status', '0')
->where('user_id', $user)
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '0')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$tagihan = tagihan::get();
$siswa = User::where('role', 'siswa')->get();
$transaksi = Transaksi::with('user')
->where('tagihan_id', '2')
->where('user_id', $user)
->get();
$total = Transaksi::selectRaw('user_id, tagihan_id, SUM(total) as total_sum')
->where('tagihan_id', '4') // Filter berdasarkan tagihan_id tertentu
->where('user_id', $user) // Filter berdasarkan user_id tertentu
->groupBy('user_id', 'tagihan_id') // Kelompokkan berdasarkan user_id dan tagihan_id
->get();
$transaksi2 = Transaksi::with('user')
->where('tagihan_id', '2')
->where('status', '2')
->where('user_id', $user)
->limit(1)
->get();
$totalcicilan = Cicilan::selectRaw('user_id, tagihan_id, SUM(total) as total_sum')
->where('tagihan_id', '2') // Filter berdasarkan tagihan_id tertentu
->where('user_id', $user) // Filter berdasarkan user_id tertentu
->groupBy('user_id', 'tagihan_id') // Kelompokkan berdasarkan user_id dan tagihan_id
->get();
$cicilan = Cicilan::where('tagihan_id', '2')
->where('user_id', $user)
->get();
$userjurusan = Auth::user()->jurusan;
$rekening = Rekening::where('jurusan', $userjurusan)->get();
return view('pages.siswa.pembayaran-daftarulang', compact('no', 'total', 'transaksi2', 'siswa', 'tagihan', 'transaksi', 'cicilan', 'totalcicilan', 'trans', 'totaltransaksi', 'rekening'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
$request->validate([
'total' => 'required|numeric|min:0',
'bukti_pembayaran' => 'required|file|mimes:jpg,jpeg,png,pdf|max:2048',
]);
// Simpan data ke database
$data = $request->all();
$data['bukti_pembayaran'] = $request->file('bukti_pembayaran')->store('assets/bukti_transaksi', 'public');
$tgl = $data['tgl'] = Carbon::now();
$cicilan = Cicilan::create($data);
$this->updateTransaksiStatus($cicilan, $tgl);
return redirect()->route('Tagihan-DaftarUlang.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
return redirect()->route('Tagihan-DaftarUlang.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
private function updateTransaksiStatus($cicilan, $tgl)
{
$tagihanId = $cicilan->tagihan_id;
$userId = $cicilan->user_id;
// Hitung total cicilan untuk tagihan_id dan user_id yang sama
$totalCicilan = Cicilan::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->sum('total');
// Hitung total transaksi untuk tagihan_id dan user_id yang sama
$totalTransaksi = Transaksi::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->sum('total');
// Periksa apakah total cicilan mencapai atau melebihi total transaksi
if ($totalCicilan >= $totalTransaksi) {
// Update status transaksi menjadi 'LUNAS'
Transaksi::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->update(['status' => '1', 'tgl_pembayaran' => $tgl]);
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,165 @@
<?php
namespace App\Http\Controllers\Siswa;
use Carbon\Carbon;
use App\Models\User;
use App\Models\Cicilan;
use App\Models\tagihan;
use App\Models\Rekening;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
class PembayaranKainSeragamController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$user = Auth::id();
$no = 1;
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('status', '0')
->where('user_id', $user)
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '0')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$tagihan = tagihan::get();
$siswa = User::where('role', 'siswa')->get();
$transaksi = Transaksi::with('user')
->where('tagihan_id', '4')
->where('user_id', $user)
->get();
$total = Transaksi::selectRaw('user_id, tagihan_id, SUM(total) as total_sum')
->where('tagihan_id', '4') // Filter berdasarkan tagihan_id tertentu
->where('user_id', $user) // Filter berdasarkan user_id tertentu
->groupBy('user_id', 'tagihan_id') // Kelompokkan berdasarkan user_id dan tagihan_id
->get();
$transaksi2 = Transaksi::with('user')
->where('tagihan_id', '4')
->where('status', '2')
->where('user_id', $user)
->limit(1)
->get();
$totalcicilan = Cicilan::selectRaw('user_id, tagihan_id, SUM(total) as total_sum')
->where('tagihan_id', '4') // Filter berdasarkan tagihan_id tertentu
->where('user_id', $user) // Filter berdasarkan user_id tertentu
->groupBy('user_id', 'tagihan_id') // Kelompokkan berdasarkan user_id dan tagihan_id
->get();
$cicilan = Cicilan::where('tagihan_id', '4')
->where('user_id', $user)
->get();
$userjurusan = Auth::user()->jurusan;
$rekening = Rekening::where('jurusan', $userjurusan)->get();
return view('pages.siswa.pembayaran-kainseragam', compact('no', 'total', 'transaksi2', 'siswa', 'tagihan', 'transaksi', 'cicilan', 'totalcicilan', 'trans', 'totaltransaksi', 'rekening'));
}
public function cetak($id)
{
$user = Auth::user()->id;
$no = 1;
$title = 'Kain Seragam';
$transaksi = Transaksi::with('user')
->where('tagihan_id', $id)
->where('user_id', $user)
->get();
$total = Transaksi::selectRaw('user_id, tagihan_id, SUM(total) as total_sum')
->where('tagihan_id', $id) // Filter berdasarkan tagihan_id tertentu
->where('user_id', $user) // Filter berdasarkan user_id tertentu
->groupBy('user_id', 'tagihan_id') // Kelompokkan berdasarkan user_id dan tagihan_id
->first();
return view('pages.cetak.cetak', compact('no', 'total', 'transaksi', 'title'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
$request->validate([
'total' => 'required|numeric|min:0',
'bukti_pembayaran' => 'required|file|mimes:jpg,jpeg,png,pdf|max:2048',
]);
// Simpan data ke database
$data = $request->all();
$data['bukti_pembayaran'] = $request->file('bukti_pembayaran')->store('assets/bukti_transaksi', 'public');
$tgl = $data['tgl'] = Carbon::now();
$cicilan = Cicilan::create($data);
$this->updateTransaksiStatus($cicilan, $tgl);
return redirect()->route('Tagihan-KainSeragam.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
return redirect()->route('Tagihan-KainSeragam.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
private function updateTransaksiStatus($cicilan, $tgl)
{
$tagihanId = $cicilan->tagihan_id;
$userId = $cicilan->user_id;
// Hitung total cicilan untuk tagihan_id dan user_id yang sama
$totalCicilan = Cicilan::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->sum('total');
// Hitung total transaksi untuk tagihan_id dan user_id yang sama
$totalTransaksi = Transaksi::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->sum('total');
// Periksa apakah total cicilan mencapai atau melebihi total transaksi
if ($totalCicilan >= $totalTransaksi) {
// Update status transaksi menjadi 'LUNAS'
Transaksi::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->update(['status' => '1', 'tgl_pembayaran' => $tgl]);
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,101 @@
<?php
namespace App\Http\Controllers\Siswa;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Rekening;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
class PembayaranLainnyaController extends Controller
{
public function index()
{
$user = Auth::id();
$tagihan = tagihan::get();
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('status', '0')
->where('user_id', $user)
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '0')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$siswa = User::where('role', 'siswa')->get();
$transaksi = Transaksi::with('user')
->where('tagihan_id', '6')
->where('user_id', $user)
->get();
$userjurusan = Auth::user()->jurusan;
$rekening = Rekening::where('jurusan', $userjurusan)->get();
return view('pages.siswa.pembayaran-lainnya', compact('siswa', 'tagihan', 'transaksi', 'trans', 'totaltransaksi', 'rekening'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke database
Transaksi::create($request->all());
return redirect()->route('Tagihan-Lainnya.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
dd($e); // Menampilkan informasi exception ke terminal
return redirect()->route('Tagihan-Lainnya.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$data = $request->all();
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
$item = Transaksi::findOrFail($id);
$item->update($data);
return redirect()->route('Tagihan-Lainnya.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Transaksi::findOrFail($id);
$data->delete();
return redirect()->route('Tagihan-Lainnya.index');
}
}

View File

@ -0,0 +1,166 @@
<?php
namespace App\Http\Controllers\Siswa;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Cicilan;
use App\Models\Rekening;
use Illuminate\Support\Facades\Auth;
use Carbon\Carbon;
class PembayaranPendaftaranController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$user = Auth::user()->id;
$userjurusan = Auth::user()->jurusan;
$no = 1;
$tagihan = tagihan::get();
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('status', '0')
->where('user_id', $user)
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '0')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$siswa = User::where('role', 'siswa')->get();
$transaksi = Transaksi::with('user')
->where('tagihan_id', '3')
->where('user_id', $user)
->get();
$transaksi2 = Transaksi::with('user')
->where('tagihan_id', '3')
->where('status', '2')
->where('user_id', $user)
->limit(1)
->get();
$total = Transaksi::selectRaw('user_id, tagihan_id, SUM(total) as total_sum')
->where('tagihan_id', '3') // Filter berdasarkan tagihan_id tertentu
->where('user_id', $user) // Filter berdasarkan user_id tertentu
->groupBy('user_id', 'tagihan_id') // Kelompokkan berdasarkan user_id dan tagihan_id
->first();
$totalcicilan = Cicilan::selectRaw('user_id, tagihan_id, SUM(total) as total_sum')
->where('tagihan_id', '3') // Filter berdasarkan tagihan_id tertentu
->where('user_id', $user) // Filter berdasarkan user_id tertentu
->groupBy('user_id', 'tagihan_id') // Kelompokkan berdasarkan user_id dan tagihan_id
->get();
$cicilan = Cicilan::where('tagihan_id', '3')
->where('user_id', $user)
->get();
$rekening = Rekening::where('jurusan', $userjurusan)->get();
return view('pages.siswa.pembayaran-pendaftaran', compact('no', 'transaksi2', 'total', 'siswa', 'tagihan', 'transaksi', 'cicilan', 'totalcicilan', 'trans', 'totaltransaksi', 'rekening'));
}
public function cetak($id)
{
$user = Auth::user()->id;
$no = 1;
$title = 'Pendaftaran';
$transaksi = Transaksi::with('user')
->where('tagihan_id', $id)
->where('user_id', $user)
->get();
$total = Transaksi::selectRaw('user_id, tagihan_id, SUM(total) as total_sum')
->where('tagihan_id', $id) // Filter berdasarkan tagihan_id tertentu
->where('user_id', $user) // Filter berdasarkan user_id tertentu
->groupBy('user_id', 'tagihan_id') // Kelompokkan berdasarkan user_id dan tagihan_id
->first();
return view('pages.cetak.cetak', compact('no', 'total', 'transaksi', 'title'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
$request->validate([
'total' => 'required|numeric|min:0',
'bukti_pembayaran' => 'required|file|mimes:jpg,jpeg,png,pdf|max:2048',
]);
// Simpan data ke database
$data = $request->all();
$data['bukti_pembayaran'] = $request->file('bukti_pembayaran')->store('assets/bukti_transaksi', 'public');
$data['tgl'] = Carbon::now();
$cicilan = Cicilan::create($data);
$tgl = $request['tgl'];
$this->updateTransaksiStatus($cicilan, $tgl);
return redirect()->route('Tagihan-Pendaftaran.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
return redirect()->route('Tagihan-Pendaftaran.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
private function updateTransaksiStatus($cicilan, $tgl)
{
$tagihanId = $cicilan->tagihan_id;
$userId = $cicilan->user_id;
// Hitung total cicilan untuk tagihan_id dan user_id yang sama
$totalCicilan = Cicilan::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->sum('total');
// Hitung total transaksi untuk tagihan_id dan user_id yang sama
$totalTransaksi = Transaksi::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->sum('total');
// Periksa apakah total cicilan mencapai atau melebihi total transaksi
if ($totalCicilan >= $totalTransaksi) {
// Update status transaksi menjadi 'LUNAS'
Transaksi::where('tagihan_id', $tagihanId)
->where('user_id', $userId)
->update(['status' => '1', 'tgl_pembayaran' => $tgl]);
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,123 @@
<?php
namespace App\Http\Controllers\Siswa;
use Carbon\Carbon;
use App\Models\User;
use App\Models\tagihan;
use App\Models\Rekening;
use App\Models\Transaksi;
use App\Models\TahunAjaran;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use Yajra\DataTables\Facades\DataTables;
class PembayaranSPPController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
// Ambil nilai tahun_pelajaran dari permintaan GET
$tahunajar = $request->query('tahun_pelajaran');
$tahun = TahunAjaran::get();
$user = Auth::id();
$tagihan = tagihan::get();
$siswa = User::where('role', 'siswa')->get();
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('status', '0')
->where('user_id', $user)
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '0')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$transaksi = Transaksi::with('user')
->where('tagihan_id', '1')
->where('tahunajar', $tahunajar)
->where('user_id', $user)
->get();
$userjurusan = Auth::user()->jurusan;
$rekening = Rekening::where('jurusan', $userjurusan)->get();
return view('pages.siswa.pembayaran-spp', compact('siswa', 'tagihan', 'transaksi', 'tahun', 'trans', 'totaltransaksi', 'rekening'));
}
public function cetak($id)
{
Carbon::setLocale('id');
$transaksi = Transaksi::with('user')
->where('tagihan_id', '1')
->where('id', $id)
->get();
return view('pages.cetak.cetak-spp', compact('transaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
$data = $request->all();
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
// Simpan data ke database
Transaksi::create($data);
return redirect()->route('Tagihan-spp.index')->with('success', 'Pembayaran Sukses, tunggu konfirmasi.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
dd($e); // Menampilkan informasi exception ke terminal
return redirect()->route('Tagihan-spp.index')->with('error', 'Terjadi kesalahan saat menyimpan data.');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$data = $request->all();
$data['bukti_transaksi'] = $request->file('bukti_transaksi')->store('assets/bukti_transaksi', 'public');
$item = Transaksi::findOrFail($id);
$item->update($data);
return redirect()->route('Tagihan-spp.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Transaksi::findOrFail($id);
$data->delete();
return redirect()->route('Tagihan-spp.index');
}
}

View File

@ -0,0 +1,190 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Transaksi;
use App\Imports\SiswaImport;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Hash;
use Maatwebsite\Excel\Facades\Excel;
use Illuminate\Support\Facades\Storage;
use PhpOffice\PhpSpreadsheet\IOFactory;
use Yajra\DataTables\Facades\DataTables;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
class SiswaController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
if (Auth::user()->role == 'admin-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
if (request()->ajax()) {
$kelas = $request->input('kelas');
$query = User::where('role', 'siswa')
->where('jurusan', 'excellent');
if ($kelas) {
$query->where('kelas', $kelas);
}
return DataTables::of($query)
->addColumn('action', function ($item) {
return '
<div class="btn-group">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle mr-1 mb-1" type="button" data-toggle="dropdown">Aksi</button>
<div class="dropdown-menu">
<button class="dropdown-item"
data-id="' . $item->id . '"
data-name="' . $item->name . '"
data-email="' . $item->email . '"
data-nik="' . $item->nik . '"
data-nisn="' . $item->nisn . '"
data-no_hp="' . $item->no_hp . '"
data-alamat="' . $item->alamat . '"
data-tempat_lahir="' . $item->tempat_lahir . '"
data-tgl_lahir="' . $item->tgl_lahir . '"
data-jk="' . $item->jk . '"
data-kelas="' . $item->kelas . '"
data-jurusan="' . $item->jurusan . '"
data-toggle="modal" data-target="#editModal">Edit</button>
<form action="' . route('data-siswa-excellent.destroy', $item->id) . '" method="POST">
' . method_field('delete') . csrf_field() . '
<button type="submit" class="dropdown-item text-danger">Hapus</button>
</form>
</div>
</div>
</div>
';
})
->addColumn('no', function ($item) {
static $counter = 1;
return $counter++;
})
->addColumn('profile', function ($item) {
if ($item->foto) {
// Jika ada data bukti transaksi, tampilkan tautan dan gambar
return '<td><a href="' . Storage::url($item->foto) . '" data-lightbox="gallery">
<img src="' . Storage::url($item->foto) . '" alt="Bukti Transaksi" style="width: 100px; height: auto;">
</a></td>';
} else {
// Jika tidak ada data bukti transaksi, tampilkan tanda strip (-)
return 'Tidak Ada Foto';
}
})
->rawColumns(['action', 'profile'])
->make(true);
}
// $no = 1;
// $user = User::where('role', 'siswa')->get();
return view('pages.data-siswa', compact('trans', 'totaltransaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke database
$data = $request->all();
// Hashing kata sandi sebelum disimpan
$data['password'] = Hash::make($request->password);
// Membuat user baru dan menyimpan ke database
User::create($data);
return redirect()->route('data-siswa-excellent.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
dd($e);
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('data-siswa-excellent.index')->with('error', 'Key yang anda masukkan tidak ada di saldo mon');
}
}
public function updateClasses(Request $request)
{
// Update kelas VII ke VIII
User::where('role', 'siswa')->where('kelas', 'IX')->update(['kelas' => 'Lulus']);
User::where('role', 'siswa')->where('kelas', 'VIII')->update(['kelas' => 'IX']);
User::where('role', 'siswa')->where('kelas', 'VII')->update(['kelas' => 'VIII']);
// Bisa tambahkan notifikasi atau redirect setelah update
return redirect()->back()->with('success', 'Kelas siswa berhasil diperbarui.');
}
public function importData(Request $request)
{
$file = $request->file('excel_file');
// dd($file);
Excel::import(new SiswaImport, $file);
return redirect()->back()->with('success', 'Data berhasil diimpor.');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$data = $request->all();
$item = User::findOrFail($id);
$item->update($data);
return redirect()->route('data-siswa-excellent.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = User::findOrFail($id);
$data->delete();
return redirect()->route('data-siswa-excellent.index');
}
}

View File

@ -0,0 +1,188 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Transaksi;
use App\Imports\SiswaImport;
use App\Imports\UsersRegulerImport;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Maatwebsite\Excel\Facades\Excel;
use Illuminate\Support\Facades\Storage;
use Yajra\DataTables\Facades\DataTables;
class SiswaRegulerController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
if (Auth::user()->role == 'admin-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
if (request()->ajax()) {
$kelas = $request->input('kelas');
$query = User::where('role', 'siswa')
->where('jurusan', 'reguler');
if ($kelas) {
$query->where('kelas', $kelas);
}
return DataTables::of($query)
->addColumn('action', function ($item) {
return '
<div class="btn-group">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle mr-1 mb-1" type="button" data-toggle="dropdown">Aksi</button>
<div class="dropdown-menu">
<button class="dropdown-item"
data-id="' . $item->id . '"
data-name="' . $item->name . '"
data-email="' . $item->email . '"
data-nik="' . $item->nik . '"
data-nisn="' . $item->nisn . '"
data-no_hp="' . $item->no_hp . '"
data-alamat="' . $item->alamat . '"
data-tempat_lahir="' . $item->tempat_lahir . '"
data-tgl_lahir="' . $item->tgl_lahir . '"
data-jk="' . $item->jk . '"
data-kelas="' . $item->kelas . '"
data-jurusan="' . $item->jurusan . '"
data-toggle="modal" data-target="#editModal">Edit</button>
<form action="' . route('data-siswa-reguler.destroy', $item->id) . '" method="POST">
' . method_field('delete') . csrf_field() . '
<button type="submit" class="dropdown-item text-danger">Hapus</button>
</form>
</div>
</div>
</div>
';
})
->addColumn('no', function ($item) {
static $counter = 1;
return $counter++;
})
->addColumn('profile', function ($item) {
if ($item->foto) {
// Jika ada data bukti transaksi, tampilkan tautan dan gambar
return '<td><a href="' . Storage::url($item->foto) . '" data-lightbox="gallery">
<img src="' . Storage::url($item->foto) . '" alt="Bukti Transaksi" style="width: 100px; height: auto;">
</a></td>';
} else {
// Jika tidak ada data bukti transaksi, tampilkan tanda strip (-)
return 'Tidak Ada Foto';
}
})
->rawColumns(['action', 'profile'])
->make(true);
}
// $no = 1;
// $user = User::where('role', 'siswa')->get();
return view('pages.data-siswa-reguler', compact('trans', 'totaltransaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke database
$data = $request->all();
// Hashing kata sandi sebelum disimpan
$data['password'] = Hash::make($request->password);
// Membuat user baru dan menyimpan ke database
User::create($data);
return redirect()->route('data-siswa-reguler.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
dd($e);
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('data-siswa-reguler.index')->with('error', 'Key yang anda masukkan tidak ada di saldo mon');
}
}
public function updateClasses(Request $request)
{
// Update kelas VII ke VIII
User::where('role', 'siswa')->where('kelas', 'IX')->update(['kelas' => 'Lulus']);
User::where('role', 'siswa')->where('kelas', 'VIII')->update(['kelas' => 'IX']);
User::where('role', 'siswa')->where('kelas', 'VII')->update(['kelas' => 'VIII']);
// Bisa tambahkan notifikasi atau redirect setelah update
return redirect()->back()->with('success', 'Kelas siswa berhasil diperbarui.');
}
public function importData(Request $request)
{
$file = $request->file('excel_file');
// dd($file);
Excel::import(new UsersRegulerImport, $file);
return redirect()->back()->with('success', 'Data berhasil diimpor.');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$data = $request->all();
$item = User::findOrFail($id);
$item->update($data);
return redirect()->route('data-siswa-reguler.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = User::findOrFail($id);
$data->delete();
return redirect()->route('data-siswa-reguler.index');
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace App\Http\Controllers;
use App\Models\Transaksi;
use App\Models\TahunAjaran;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class TahunAjaranController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
if (Auth::user()->role == 'bendahara-excellent') {
$jurusan = 'excellent';
} elseif (Auth::user()->jurusan == 'bendahara-reguller') {
$jurusan = 'reguller';
} else {
$jurusan = 'NULL';
}
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
$no = 1;
$tahun = TahunAjaran::get();
return view('pages.data-tahunajaran', compact(
'tahun',
'no',
'trans',
'totaltransaksi',
));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke database
TahunAjaran::create($request->all());
return redirect()->route('Tahun-Ajaran.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
dd($e);
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('Tahun-Ajaran.index')->with('error', 'Key yang anda masukkan tidak ada di saldo mon');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$data = $request->all();
$item = TahunAjaran::findOrFail($id);
$item->update($data);
return redirect()->route('Tahun-Ajaran.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = TahunAjaran::findOrFail($id);
$data->delete();
return redirect()->route('Tahun-Ajaran.index');
}
}

View File

@ -0,0 +1,73 @@
<?php
namespace App\Http\Controllers;
use App\Models\Transaksi;
use Illuminate\Http\Request;
class TransactionController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('pages.data-transaksi');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke database
Transaksi::create($request->all());
return redirect()->route('data-transaksi.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('data-transaksi.index')->with('error', 'Key yang anda masukkan tidak ada di saldo mon');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}

View File

@ -0,0 +1,159 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Transaksi;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Storage;
use Yajra\DataTables\Facades\DataTables;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$roles = ['bendahara-excellent', 'bendahara-reguler'];
if (Auth::user()->role == 'bendahara-excellent')
$jurusan = 'excellent';
else
$jurusan = 'reguler';
$trans = Transaksi::with(['user', 'jenistagihan'])
->where('jurusan', $jurusan)
->where('status', '1')
->whereNotNull('tgl_pembayaran')
->latest()
->get();
$totaltransaksi = Transaksi::where('status', '1')->count();
$trans->map(function ($item) {
$item->tgl_pembayaran_formatted = \Carbon\Carbon::parse($item->tgl_pembayaran)->format('F j, Y');
return $item;
});
if (request()->ajax()) {
$query = User::whereIn('role', $roles);
return DataTables::of($query)
->addColumn('action', function ($item) {
// $barcode = DNS1D::getBarcodeHTML($item->id, 'C128', 2, 50);
return '
<div class="btn-group">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle mr-1 mb-1" type="button" data-toggle="dropdown">Aksi</button>
<div class="dropdown-menu">
<button class="dropdown-item"
data-id="' . $item->id . '"
data-name="' . $item->name . '"
data-email="' . $item->email . '"
data-nik="' . $item->nik . '"
data-no_hp="' . $item->no_hp . '"
data-alamat="' . $item->alamat . '"
data-tempat_lahir="' . $item->tempat_lahir . '"
data-tgl_lahir="' . $item->tgl_lahir . '"
data-jk="' . $item->jk . '"
data-kelas="' . $item->kelas . '"
data-toggle="modal" data-target="#editModal">Edit</button>
<form action="' . route('data-user.destroy', $item->id) . '" method="POST">
' . method_field('delete') . csrf_field() . '
<button type="submit" class="dropdown-item text-danger">Hapus</button>
</form>
</div>
</div>
</div>
';
})
->addColumn('no', function ($item) {
static $counter = 1;
return $counter++;
})
->addColumn('profile', function ($item) {
if ($item->foto) {
// Jika ada data bukti transaksi, tampilkan tautan dan gambar
return '<td><a href="' . Storage::url($item->foto) . '" data-lightbox="gallery">
<img src="' . Storage::url($item->foto) . '" alt="Bukti Transaksi" style="width: 100px; height: auto;">
</a></td>';
} else {
// Jika tidak ada data bukti transaksi, tampilkan tanda strip (-)
return 'Tidak Ada Foto';
}
})
->rawColumns(['action', 'profile'])
->make(true);
}
// $no = 1;
// $user = User::where('role', 'siswa')->get();
return view('pages.data-user', compact('trans', 'totaltransaksi'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke database
// Mendapatkan semua data dari request
$data = $request->all();
// Hashing kata sandi sebelum disimpan
$data['password'] = Hash::make($request->password);
// Membuat user baru dan menyimpan ke database
User::create($data);
return redirect()->route('data-user.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
dd($e);
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('data-user.index')->with('error', 'Key yang anda masukkan tidak ada di saldo mon');
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$data = $request->all();
$item = User::findOrFail($id);
$item->update($data);
return redirect()->route('data-user.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = User::findOrFail($id);
$data->delete();
return redirect()->route('data-user.index');
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Http\Controllers\api;
use App\Models\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
class getDataController extends Controller
{
public function getSiswa($jurusan)
{
$siswa = User::where('role', 'siswa')
->where('jurusan', $jurusan)
->get();
return response()->json($siswa);
}
}

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

@ -0,0 +1,74 @@
<?php
namespace App\Http;
use Illuminate\Console\Scheduling\Schedule;
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 instead of class names 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,
'role' => \App\Http\Middleware\CheckRole::class,
];
protected function schedule(Schedule $schedule)
{
$schedule->command('billing:send')->daily();
}
}

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,30 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class CheckRole
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle($request, Closure $next)
{
$roles = array_slice(func_get_args(), 2);
foreach ($roles as $role) {
$user = Auth::user()->role;
if ($user == $role) {
return $next($request);
}
}
return redirect()->back();
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,40 @@
<?php
namespace App\Imports;
use Carbon\Carbon;
use App\Models\User;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Maatwebsite\Excel\Concerns\ToModel;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use Maatwebsite\Excel\Concerns\ToCollection;
use Maatwebsite\Excel\Concerns\WithStartRow;
class SiswaImport implements ToModel, WithStartRow
{
public function startRow(): int
{
return 2; // Mulai dari baris kedua
}
public function model(array $row)
{
Log::info('Row data: ' . json_encode($row));
return new User([
'name' => $row[0],
'email' => $row[1],
'nik' => $row[2],
'alamat' => $row[3],
'no_hp' => $row[4],
'tempat_lahir' => $row[5],
'tgl_lahir' => Date::excelToDateTimeObject($row[6])->format('Y-m-d'), // Tanggal lahir dalam format "YYYY-MM-DD"
'jk' => $row[7],
'kelas' => $row[8],
'password' => bcrypt('12345678'),
'role' => 'siswa',
'jurusan' => 'excellent',
]);
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Imports;
use Carbon\Carbon;
use App\Models\User;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Maatwebsite\Excel\Concerns\ToModel;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use Maatwebsite\Excel\Concerns\ToCollection;
use Maatwebsite\Excel\Concerns\WithStartRow;
class UsersRegulerImport implements ToModel, WithStartRow
{
public function startRow(): int
{
return 2; // Mulai dari baris kedua
}
public function model(array $row)
{
Log::info('Row data: ' . json_encode($row));
return new User([
'name' => $row[0],
'email' => $row[1],
'nik' => $row[2],
'alamat' => $row[3],
'no_hp' => $row[4],
'tempat_lahir' => $row[5],
'tgl_lahir' => Date::excelToDateTimeObject($row[6])->format('Y-m-d'), // Tanggal lahir dalam format "YYYY-MM-DD"
'jk' => $row[7],
'kelas' => $row[8],
'password' => bcrypt('12345678'),
'role' => 'siswa',
'jurusan' => 'reguler',
]);
}
}

27
app/Mail/BillingEmail.php Normal file
View File

@ -0,0 +1,27 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class BillingEmail extends Mailable
{
use Queueable, SerializesModels;
public $user;
public $tagihans;
public function __construct($user, $tagihans)
{
$this->user = $user;
$this->tagihans = $tagihans;
}
public function build()
{
return $this->subject('Tagihan Bulanan')->view('emails.billing');
}
}

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

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Cicilan extends Model
{
use HasFactory;
protected $table = 'cicil';
protected $fillable = [
'tgl',
'total',
'bukti_pembayaran',
'tagihan_id',
'user_id',
];
public function jenistagihan()
{
return $this->belongsTo(tagihan::class, 'tagihan_id', 'id');
}
}

18
app/Models/Rekening.php Normal file
View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Rekening extends Model
{
use HasFactory;
protected $table = 'rekening';
protected $fillable = [
'nama_bank',
'norek',
'atas_nama',
'jurusan',
];
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TahunAjaran extends Model
{
use HasFactory;
protected $table = 'tahunajaran';
protected $fillable = [
'tahunawal',
'tahunakhir',
'status'
];
}

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

@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Transaksi extends Model
{
use HasFactory;
protected $table = 'transaksi';
protected $fillable = [
'keterangan',
'date_awal',
'date_akhir',
'total',
'jenis_transaksi',
'bukti_transaksi',
'metode',
'status',
'tagihan_id',
'user_id',
'tgl_pembayaran',
'tahunajar',
'jurusan'
];
public function user()
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
public function jenistagihan()
{
return $this->belongsTo(tagihan::class, 'tagihan_id', 'id');
}
}

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

@ -0,0 +1,60 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'nik',
'alamat',
'no_hp',
'tempat_lahir',
'tgl_lahir',
'jk',
'foto',
'kelas',
'role',
'jurusan',
'nisn',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public function transaksi()
{
return $this->hasMany(Transaksi::class);
}
}

17
app/Models/profile.php Normal file
View File

@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class profile extends Model
{
use HasFactory;
protected $table = 'profileweb';
protected $fillable = [
'foto',
'name',
'alamat',
];
}

15
app/Models/tagihan.php Normal file
View File

@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class tagihan extends Model
{
use HasFactory;
protected $table = 'jenistagihan';
protected $fillable = [
'name'
];
}

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,26 @@
<?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 = [
//
];
/**
* Register any authentication / authorization services.
*/
public function boot(): void
{
//
}
}

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,40 @@
<?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 your application's "home" route.
*
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = '/dashboard';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*/
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
$this->routes(function () {
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
}

View File

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

View File

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

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

71
composer.json Normal file
View File

@ -0,0 +1,71 @@
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.1",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.8",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.3",
"maatwebsite/excel": "^3.1",
"phpoffice/phpspreadsheet": "1.18",
"yajra/laravel-datatables": "10.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/breeze": "^1.28",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"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": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

9401
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

191
config/app.php Normal file
View File

@ -0,0 +1,191 @@
<?php
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\ServiceProvider;
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' => ServiceProvider::defaultProviders()->merge([
/*
* 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,
Yajra\DataTables\DataTablesServiceProvider::class,
Maatwebsite\Excel\ExcelServiceProvider::class,
])->toArray(),
/*
|--------------------------------------------------------------------------
| 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([
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
// 'Example' => App\Facades\Example::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 expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => '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'),
],
],
];

127
config/datatables.php Normal file
View File

@ -0,0 +1,127 @@
<?php
return [
/*
* DataTables search options.
*/
'search' => [
/*
* Smart search will enclose search keyword with wildcard string "%keyword%".
* SQL: column LIKE "%keyword%"
*/
'smart' => true,
/*
* Multi-term search will explode search keyword using spaces resulting into multiple term search.
*/
'multi_term' => true,
/*
* Case insensitive will search the keyword in lower case format.
* SQL: LOWER(column) LIKE LOWER(keyword)
*/
'case_insensitive' => true,
/*
* Wild card will add "%" in between every characters of the keyword.
* SQL: column LIKE "%k%e%y%w%o%r%d%"
*/
'use_wildcards' => false,
/*
* Perform a search which starts with the given keyword.
* SQL: column LIKE "keyword%"
*/
'starts_with' => false,
],
/*
* DataTables internal index id response column name.
*/
'index_column' => 'DT_RowIndex',
/*
* List of available builders for DataTables.
* This is where you can register your custom dataTables builder.
*/
'engines' => [
'eloquent' => Yajra\DataTables\EloquentDataTable::class,
'query' => Yajra\DataTables\QueryDataTable::class,
'collection' => Yajra\DataTables\CollectionDataTable::class,
'resource' => Yajra\DataTables\ApiResourceDataTable::class,
],
/*
* DataTables accepted builder to engine mapping.
* This is where you can override which engine a builder should use
* Note, only change this if you know what you are doing!
*/
'builders' => [
//Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent',
//Illuminate\Database\Eloquent\Builder::class => 'eloquent',
//Illuminate\Database\Query\Builder::class => 'query',
//Illuminate\Support\Collection::class => 'collection',
],
/*
* Nulls last sql pattern for PostgreSQL & Oracle.
* For MySQL, use 'CASE WHEN :column IS NULL THEN 1 ELSE 0 END, :column :direction'
*/
'nulls_last_sql' => ':column :direction NULLS LAST',
/*
* User friendly message to be displayed on user if error occurs.
* Possible values:
* null - The exception message will be used on error response.
* 'throw' - Throws a \Yajra\DataTables\Exceptions\Exception. Use your custom error handler if needed.
* 'custom message' - Any friendly message to be displayed to the user. You can also use translation key.
*/
'error' => env('DATATABLES_ERROR', null),
/*
* Default columns definition of dataTable utility functions.
*/
'columns' => [
/*
* List of columns hidden/removed on json response.
*/
'excess' => ['rn', 'row_num'],
/*
* List of columns to be escaped. If set to *, all columns are escape.
* Note: You can set the value to empty array to disable XSS protection.
*/
'escape' => '*',
/*
* List of columns that are allowed to display html content.
* Note: Adding columns to list will make us available to XSS attacks.
*/
'raw' => ['action'],
/*
* List of columns are forbidden from being searched/sorted.
*/
'blacklist' => ['password', 'remember_token'],
/*
* List of columns that are only allowed fo search/sort.
* If set to *, all columns are allowed.
*/
'whitelist' => '*',
],
/*
* JsonResponse header and options config.
*/
'json' => [
'header' => [],
'options' => 0,
],
/*
* Default condition to determine if a parameter is a callback or not.
* Callbacks needs to start by those terms, or they will be cast to string.
*/
'callback' => ['$', '$.', 'function'],
];

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',
],
'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'),
],
];

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