first commit
This commit is contained in:
18
.editorconfig
Normal file
18
.editorconfig
Normal file
@@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[compose.yaml]
|
||||
indent_size = 4
|
||||
65
.env.example
Normal file
65
.env.example
Normal file
@@ -0,0 +1,65 @@
|
||||
APP_NAME="MyBajet MBIP"
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
APP_LOCALE=ms
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=ms_MY
|
||||
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
# APP_MAINTENANCE_STORE=database
|
||||
|
||||
# PHP_CLI_SERVER_WORKERS=4
|
||||
|
||||
BCRYPT_ROUNDS=12
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_STACK=single
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=mybajet_mbip
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
SESSION_DOMAIN=null
|
||||
|
||||
BROADCAST_CONNECTION=log
|
||||
FILESYSTEM_DISK=public
|
||||
QUEUE_CONNECTION=database
|
||||
|
||||
CACHE_STORE=database
|
||||
# CACHE_PREFIX=
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=log
|
||||
MAIL_SCHEME=null
|
||||
MAIL_HOST=127.0.0.1
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_FROM_ADDRESS="noreply@mbip.gov.my"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
11
.gitattributes
vendored
Normal file
11
.gitattributes
vendored
Normal 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
|
||||
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpactor.json
|
||||
.phpunit.result.cache
|
||||
/.fleet
|
||||
/.idea
|
||||
/.nova
|
||||
/.phpunit.cache
|
||||
/.vscode
|
||||
/.zed
|
||||
/auth.json
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/storage/pail
|
||||
/vendor
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
Thumbs.db
|
||||
59
README.md
Normal file
59
README.md
Normal file
@@ -0,0 +1,59 @@
|
||||
<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 can also check out [Laravel Learn](https://laravel.com/learn), where you will be guided through building a modern Laravel application.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of 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 Partners program](https://partners.laravel.com).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
|
||||
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
|
||||
- **[Redberry](https://redberry.international/laravel-development)**
|
||||
- **[Active Logic](https://activelogic.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).
|
||||
29
app/Exports/PermohonanExport.php
Normal file
29
app/Exports/PermohonanExport.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Permohonan;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class PermohonanExport implements FromCollection, WithHeadings
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Permohonan::with(['user', 'jabatan', 'vot'])->get()->map(fn ($p) => [
|
||||
$p->no_rujukan,
|
||||
$p->user?->name,
|
||||
$p->jabatan?->nama,
|
||||
$p->vot?->kod,
|
||||
$p->kategori,
|
||||
$p->status,
|
||||
$p->jumlah_keseluruhan,
|
||||
optional($p->submitted_at)->format('d/m/Y'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return ['No Rujukan', 'Pemohon', 'Jabatan', 'VOT', 'Kategori', 'Status', 'Jumlah', 'Tarikh Hantar'];
|
||||
}
|
||||
}
|
||||
27
app/Http/Controllers/Admin/ApprovalController.php
Normal file
27
app/Http/Controllers/Admin/ApprovalController.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Permohonan;
|
||||
|
||||
class ApprovalController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$permohonan = Permohonan::with(['user', 'jabatan', 'vot'])->latest()->paginate(10);
|
||||
return view('reports.permohonan', compact('permohonan'));
|
||||
}
|
||||
|
||||
public function approve(Permohonan $permohonan)
|
||||
{
|
||||
$permohonan->update(['status' => 'Approved', 'approved_by' => auth()->id(), 'approved_at' => now()]);
|
||||
return back()->with('success', 'Permohonan diluluskan.');
|
||||
}
|
||||
|
||||
public function reopen(Permohonan $permohonan)
|
||||
{
|
||||
$permohonan->update(['status' => 'Under Review', 'approved_by' => null, 'approved_at' => null]);
|
||||
return back()->with('success', 'Permohonan dibuka semula.');
|
||||
}
|
||||
}
|
||||
53
app/Http/Controllers/Admin/JabatanController.php
Normal file
53
app/Http/Controllers/Admin/JabatanController.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Jabatan;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class JabatanController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$jabatan = Jabatan::query()
|
||||
->when($request->search, fn ($q, $v) => $q->where('nama', 'like', "%$v%")->orWhere('kod', 'like', "%$v%"))
|
||||
->when($request->peringkat, fn ($q, $v) => $q->where('peringkat', $v))
|
||||
->latest()->paginate(10)->withQueryString();
|
||||
|
||||
return view('admin.jabatan.index', compact('jabatan'));
|
||||
}
|
||||
|
||||
public function create() { return view('admin.jabatan.form', ['jabatan' => new Jabatan()]); }
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
Jabatan::create($this->validated($request));
|
||||
return redirect()->route('jabatan.index')->with('success', 'Jabatan berjaya ditambah.');
|
||||
}
|
||||
|
||||
public function edit(Jabatan $jabatan) { return view('admin.jabatan.form', compact('jabatan')); }
|
||||
|
||||
public function update(Request $request, Jabatan $jabatan)
|
||||
{
|
||||
$jabatan->update($this->validated($request, $jabatan->id));
|
||||
return redirect()->route('jabatan.index')->with('success', 'Jabatan berjaya dikemaskini.');
|
||||
}
|
||||
|
||||
public function destroy(Jabatan $jabatan)
|
||||
{
|
||||
$jabatan->delete();
|
||||
return back()->with('success', 'Jabatan dipadam secara soft delete.');
|
||||
}
|
||||
|
||||
private function validated(Request $request, ?int $id = null): array
|
||||
{
|
||||
return $request->validate([
|
||||
'nama' => ['required', 'max:255'],
|
||||
'peringkat' => ['required', 'in:Jabatan,Bahagian,Seksyen,Unit,Sub Unit'],
|
||||
'kod' => ['nullable', 'max:50', 'unique:jabatan,kod,'.$id],
|
||||
'penerangan' => ['nullable'],
|
||||
'status' => ['nullable', 'boolean'],
|
||||
]) + ['status' => $request->boolean('status')];
|
||||
}
|
||||
}
|
||||
29
app/Http/Controllers/Admin/ReportController.php
Normal file
29
app/Http/Controllers/Admin/ReportController.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Exports\PermohonanExport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Permohonan;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class ReportController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$permohonan = Permohonan::with(['user', 'jabatan', 'vot'])->latest()->paginate(20);
|
||||
return view('reports.index', compact('permohonan'));
|
||||
}
|
||||
|
||||
public function excel()
|
||||
{
|
||||
return Excel::download(new PermohonanExport(), 'laporan-permohonan.xlsx');
|
||||
}
|
||||
|
||||
public function pdf()
|
||||
{
|
||||
$permohonan = Permohonan::with(['user', 'jabatan', 'vot'])->latest()->get();
|
||||
return Pdf::loadView('reports.pdf', compact('permohonan'))->download('laporan-permohonan.pdf');
|
||||
}
|
||||
}
|
||||
50
app/Http/Controllers/Admin/RoleController.php
Normal file
50
app/Http/Controllers/Admin/RoleController.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class RoleController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('admin.roles.index', ['roles' => Role::with('permissions')->paginate(10)]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('admin.roles.form', ['role' => new Role(), 'permissions' => Permission::orderBy('name')->get()]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate(['name' => ['required', 'unique:roles,name'], 'permissions' => ['array']]);
|
||||
$role = Role::create(['name' => $validated['name'], 'guard_name' => 'web']);
|
||||
$role->syncPermissions($validated['permissions'] ?? []);
|
||||
|
||||
return redirect()->route('roles.index')->with('success', 'Role berjaya ditambah.');
|
||||
}
|
||||
|
||||
public function edit(Role $role)
|
||||
{
|
||||
return view('admin.roles.form', ['role' => $role, 'permissions' => Permission::orderBy('name')->get()]);
|
||||
}
|
||||
|
||||
public function update(Request $request, Role $role)
|
||||
{
|
||||
$validated = $request->validate(['name' => ['required', 'unique:roles,name,'.$role->id], 'permissions' => ['array']]);
|
||||
$role->update(['name' => $validated['name']]);
|
||||
$role->syncPermissions($validated['permissions'] ?? []);
|
||||
|
||||
return redirect()->route('roles.index')->with('success', 'Role berjaya dikemaskini.');
|
||||
}
|
||||
|
||||
public function destroy(Role $role)
|
||||
{
|
||||
$role->delete();
|
||||
return back()->with('success', 'Role berjaya dipadam.');
|
||||
}
|
||||
}
|
||||
95
app/Http/Controllers/Admin/UserController.php
Normal file
95
app/Http/Controllers/Admin/UserController.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Jabatan;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$users = User::with(['jabatan', 'roles'])
|
||||
->when($request->search, fn ($q, $v) => $q->where('name', 'like', "%$v%")->orWhere('email', 'like', "%$v%"))
|
||||
->latest()->paginate(10)->withQueryString();
|
||||
|
||||
return view('admin.users.index', compact('users'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('admin.users.form', $this->formData(new User()));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $this->validated($request);
|
||||
$role = $validated['role'] ?? null;
|
||||
unset($validated['role']);
|
||||
$validated['password'] = Hash::make($validated['password']);
|
||||
$user = User::create($validated);
|
||||
$user->syncRoles($role ? [$role] : []);
|
||||
|
||||
return redirect()->route('users.index')->with('success', 'User berjaya ditambah.');
|
||||
}
|
||||
|
||||
public function edit(User $user)
|
||||
{
|
||||
return view('admin.users.form', $this->formData($user));
|
||||
}
|
||||
|
||||
public function update(Request $request, User $user)
|
||||
{
|
||||
$validated = $this->validated($request, $user->id);
|
||||
$role = $validated['role'] ?? null;
|
||||
unset($validated['role']);
|
||||
if (empty($validated['password'])) {
|
||||
unset($validated['password']);
|
||||
} else {
|
||||
$validated['password'] = Hash::make($validated['password']);
|
||||
}
|
||||
$user->update($validated);
|
||||
$user->syncRoles($role ? [$role] : []);
|
||||
|
||||
return redirect()->route('users.index')->with('success', 'User berjaya dikemaskini.');
|
||||
}
|
||||
|
||||
public function destroy(User $user)
|
||||
{
|
||||
$user->update(['status' => ! $user->status]);
|
||||
return back()->with('success', 'Status user berjaya dikemaskini.');
|
||||
}
|
||||
|
||||
public function resetPassword(User $user)
|
||||
{
|
||||
$user->update(['password' => Hash::make('password')]);
|
||||
return back()->with('success', 'Kata laluan diset semula kepada: password');
|
||||
}
|
||||
|
||||
private function formData(User $user): array
|
||||
{
|
||||
return [
|
||||
'user' => $user,
|
||||
'jabatan' => Jabatan::orderBy('nama')->get(),
|
||||
'roles' => Role::orderBy('name')->get(),
|
||||
];
|
||||
}
|
||||
|
||||
private function validated(Request $request, ?int $id = null): array
|
||||
{
|
||||
return $request->validate([
|
||||
'name' => ['required', 'max:255'],
|
||||
'email' => ['required', 'email', 'unique:users,email,'.$id],
|
||||
'no_telefon' => ['nullable', 'max:30'],
|
||||
'jawatan' => ['nullable', 'max:255'],
|
||||
'jabatan_id' => ['nullable', 'exists:jabatan,id'],
|
||||
'role' => ['nullable', 'exists:roles,name'],
|
||||
'password' => [$id ? 'nullable' : 'required', 'confirmed', 'min:8'],
|
||||
'status' => ['nullable', 'boolean'],
|
||||
]) + ['status' => $request->boolean('status')];
|
||||
}
|
||||
}
|
||||
55
app/Http/Controllers/Admin/VotController.php
Normal file
55
app/Http/Controllers/Admin/VotController.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Jabatan;
|
||||
use App\Models\Vot;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class VotController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$vot = Vot::with('jabatan')
|
||||
->when($request->search, fn ($q, $v) => $q->where('nama', 'like', "%$v%")->orWhere('kod', 'like', "%$v%"))
|
||||
->when($request->jabatan_id, fn ($q, $v) => $q->where('jabatan_id', $v))
|
||||
->latest()->paginate(10)->withQueryString();
|
||||
$jabatan = Jabatan::orderBy('nama')->get();
|
||||
|
||||
return view('admin.vot.index', compact('vot', 'jabatan'));
|
||||
}
|
||||
|
||||
public function create() { return view('admin.vot.form', ['vot' => new Vot(), 'jabatan' => Jabatan::orderBy('nama')->get()]); }
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
Vot::create($this->validated($request));
|
||||
return redirect()->route('vot.index')->with('success', 'VOT berjaya ditambah.');
|
||||
}
|
||||
|
||||
public function edit(Vot $vot) { return view('admin.vot.form', ['vot' => $vot, 'jabatan' => Jabatan::orderBy('nama')->get()]); }
|
||||
|
||||
public function update(Request $request, Vot $vot)
|
||||
{
|
||||
$vot->update($this->validated($request, $vot->id));
|
||||
return redirect()->route('vot.index')->with('success', 'VOT berjaya dikemaskini.');
|
||||
}
|
||||
|
||||
public function destroy(Vot $vot)
|
||||
{
|
||||
$vot->delete();
|
||||
return back()->with('success', 'VOT berjaya dipadam.');
|
||||
}
|
||||
|
||||
private function validated(Request $request, ?int $id = null): array
|
||||
{
|
||||
return $request->validate([
|
||||
'kod' => ['required', 'max:50', 'unique:vot,kod,'.$id],
|
||||
'nama' => ['required', 'max:255'],
|
||||
'jabatan_id' => ['nullable', 'exists:jabatan,id'],
|
||||
'penerangan' => ['nullable'],
|
||||
'status' => ['nullable', 'boolean'],
|
||||
]) + ['status' => $request->boolean('status')];
|
||||
}
|
||||
}
|
||||
25
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
25
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
public function create()
|
||||
{
|
||||
return view('auth.forgot-password');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate(['email' => ['required', 'email']]);
|
||||
$status = Password::sendResetLink($request->only('email'));
|
||||
|
||||
return $status === Password::RESET_LINK_SENT
|
||||
? back()->with('success', __($status))
|
||||
: back()->withErrors(['email' => __($status)]);
|
||||
}
|
||||
}
|
||||
47
app/Http/Controllers/Auth/LoginController.php
Normal file
47
app/Http/Controllers/Auth/LoginController.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
public function create()
|
||||
{
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$credentials = $request->validate([
|
||||
'email' => ['required', 'email'],
|
||||
'password' => ['required'],
|
||||
]);
|
||||
|
||||
if (Auth::attempt($credentials, $request->boolean('remember'))) {
|
||||
$request->session()->regenerate();
|
||||
$request->user()->update(['last_login_at' => now()]);
|
||||
activity('auth')->causedBy($request->user())->withProperties([
|
||||
'ip_address' => $request->ip(),
|
||||
'browser' => $request->userAgent(),
|
||||
])->log('Login User');
|
||||
|
||||
return redirect()->intended(route('dashboard'));
|
||||
}
|
||||
|
||||
return back()->withErrors(['email' => 'Maklumat log masuk tidak sah.'])->onlyInput('email');
|
||||
}
|
||||
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
$user = $request->user();
|
||||
activity('auth')->causedBy($user)->log('Logout User');
|
||||
Auth::logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
return redirect()->route('login');
|
||||
}
|
||||
}
|
||||
27
app/Http/Controllers/Auth/PasswordController.php
Normal file
27
app/Http/Controllers/Auth/PasswordController.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class PasswordController extends Controller
|
||||
{
|
||||
public function edit()
|
||||
{
|
||||
return view('auth.change-password');
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'current_password' => ['required', 'current_password'],
|
||||
'password' => ['required', 'confirmed', 'min:8'],
|
||||
]);
|
||||
|
||||
$request->user()->update(['password' => Hash::make($validated['password'])]);
|
||||
|
||||
return back()->with('success', 'Kata laluan berjaya dikemaskini.');
|
||||
}
|
||||
}
|
||||
34
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
34
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
public function create(Request $request, string $token)
|
||||
{
|
||||
return view('auth.reset-password', ['token' => $token, 'email' => $request->email]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'token' => ['required'],
|
||||
'email' => ['required', 'email'],
|
||||
'password' => ['required', 'confirmed', 'min:8'],
|
||||
]);
|
||||
|
||||
$status = Password::reset($request->only('email', 'password', 'password_confirmation', 'token'), function ($user, $password) {
|
||||
$user->forceFill(['password' => Hash::make($password), 'remember_token' => Str::random(60)])->save();
|
||||
});
|
||||
|
||||
return $status === Password::PASSWORD_RESET
|
||||
? redirect()->route('login')->with('success', __($status))
|
||||
: back()->withErrors(['email' => __($status)]);
|
||||
}
|
||||
}
|
||||
8
app/Http/Controllers/Controller.php
Normal file
8
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
34
app/Http/Controllers/DashboardController.php
Normal file
34
app/Http/Controllers/DashboardController.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Jabatan;
|
||||
use App\Models\Permohonan;
|
||||
use App\Models\Vot;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function __invoke()
|
||||
{
|
||||
$user = auth()->user();
|
||||
$base = Permohonan::query();
|
||||
|
||||
if ($user->hasRole('Pemohon')) {
|
||||
$base->where('user_id', $user->id);
|
||||
} elseif ($user->hasRole('Pelaksana')) {
|
||||
$base->where('jabatan_id', $user->jabatan_id);
|
||||
}
|
||||
|
||||
return view('dashboard.index', [
|
||||
'total' => (clone $base)->count(),
|
||||
'approved' => (clone $base)->where('status', 'Approved')->sum('jumlah_keseluruhan'),
|
||||
'rejected' => (clone $base)->where('status', 'Rejected')->count(),
|
||||
'pending' => (clone $base)->whereIn('status', ['Submitted', 'Under Review'])->count(),
|
||||
'byJabatan' => Jabatan::withCount('users')->limit(8)->get(),
|
||||
'byVot' => Vot::with('jabatan')->limit(8)->get(),
|
||||
'recent' => (clone $base)->latest()->with(['user', 'jabatan', 'vot'])->limit(6)->get(),
|
||||
'activities' => Activity::latest()->limit(8)->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
51
app/Http/Controllers/Pelaksana/SemakanController.php
Normal file
51
app/Http/Controllers/Pelaksana/SemakanController.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Pelaksana;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Permohonan;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SemakanController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$permohonan = Permohonan::with(['user', 'jabatan', 'vot'])
|
||||
->where('jabatan_id', auth()->user()->jabatan_id)
|
||||
->whereIn('status', ['Submitted', 'Under Review', 'Accepted', 'Rejected'])
|
||||
->latest()->paginate(10);
|
||||
|
||||
return view('pelaksana.index', compact('permohonan'));
|
||||
}
|
||||
|
||||
public function show(Permohonan $permohonan)
|
||||
{
|
||||
abort_unless($permohonan->jabatan_id === auth()->user()->jabatan_id || auth()->user()->hasRole('Admin'), 403);
|
||||
return view('pelaksana.show', ['permohonan' => $permohonan->load(['items', 'user', 'jabatan', 'vot'])]);
|
||||
}
|
||||
|
||||
public function update(Request $request, Permohonan $permohonan)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'items' => ['required', 'array'],
|
||||
'items.*.status_item' => ['required', 'in:Pending,Accepted,Rejected,Partial Accept'],
|
||||
'items.*.catatan_pelaksana' => ['nullable'],
|
||||
'catatan_semakan' => ['nullable'],
|
||||
]);
|
||||
|
||||
foreach ($validated['items'] as $id => $row) {
|
||||
$permohonan->items()->whereKey($id)->update($row);
|
||||
}
|
||||
|
||||
$hasReject = $permohonan->items()->where('status_item', 'Rejected')->exists();
|
||||
$permohonan->update([
|
||||
'status' => $hasReject ? 'Rejected' : 'Accepted',
|
||||
'status_semakan' => 'Selesai',
|
||||
'catatan_semakan' => $validated['catatan_semakan'] ?? null,
|
||||
'reviewed_by' => auth()->id(),
|
||||
'reviewed_at' => now(),
|
||||
]);
|
||||
|
||||
return redirect()->route('semakan.index')->with('success', 'Semakan berjaya dihantar kepada Admin.');
|
||||
}
|
||||
}
|
||||
93
app/Http/Controllers/Pemohon/PermohonanController.php
Normal file
93
app/Http/Controllers/Pemohon/PermohonanController.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Pemohon;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Permohonan;
|
||||
use App\Models\Vot;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class PermohonanController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$permohonan = Permohonan::with(['vot', 'jabatan'])->where('user_id', auth()->id())->latest()->paginate(10);
|
||||
return view('permohonan.index', compact('permohonan'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('permohonan.form', ['permohonan' => new Permohonan(), 'vot' => Vot::with('jabatan')->where('status', true)->get()]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $this->validated($request);
|
||||
|
||||
DB::transaction(function () use ($request, $validated) {
|
||||
$vot = Vot::findOrFail($validated['vot_id']);
|
||||
$permohonan = Permohonan::create([
|
||||
'no_rujukan' => 'MBIP/BJT/'.now()->format('YmdHis').'/'.auth()->id(),
|
||||
'user_id' => auth()->id(),
|
||||
'jabatan_id' => auth()->user()->jabatan_id ?: $vot->jabatan_id,
|
||||
'vot_id' => $vot->id,
|
||||
'kategori' => $validated['kategori'],
|
||||
'tujuan' => $validated['tujuan'],
|
||||
'status' => $request->input('action') === 'submit' ? 'Submitted' : 'Draft',
|
||||
'submitted_at' => $request->input('action') === 'submit' ? now() : null,
|
||||
'gambar_1' => $this->storeImage($request, 'gambar_1'),
|
||||
'gambar_2' => $this->storeImage($request, 'gambar_2'),
|
||||
]);
|
||||
|
||||
$total = 0;
|
||||
foreach ($validated['items'] as $row) {
|
||||
$jumlah = $row['kuantiti'] * $row['harga_anggaran'];
|
||||
$total += $jumlah;
|
||||
$permohonan->items()->create($row + ['jumlah' => $jumlah]);
|
||||
}
|
||||
$permohonan->update(['jumlah_keseluruhan' => $total]);
|
||||
});
|
||||
|
||||
return redirect()->route('permohonan.index')->with('success', 'Permohonan berjaya disimpan.');
|
||||
}
|
||||
|
||||
public function show(Permohonan $permohonan)
|
||||
{
|
||||
$this->authorizeOwner($permohonan);
|
||||
return view('permohonan.show', ['permohonan' => $permohonan->load(['items', 'vot', 'jabatan', 'user'])]);
|
||||
}
|
||||
|
||||
public function submit(Permohonan $permohonan)
|
||||
{
|
||||
$this->authorizeOwner($permohonan);
|
||||
$permohonan->update(['status' => 'Submitted', 'submitted_at' => now()]);
|
||||
return back()->with('success', 'Permohonan dihantar kepada Pelaksana.');
|
||||
}
|
||||
|
||||
private function validated(Request $request): array
|
||||
{
|
||||
return $request->validate([
|
||||
'vot_id' => ['required', 'exists:vot,id'],
|
||||
'kategori' => ['required', 'max:255'],
|
||||
'tujuan' => ['required'],
|
||||
'gambar_1' => ['nullable', 'image', 'mimes:jpg,jpeg,png', 'max:5120'],
|
||||
'gambar_2' => ['nullable', 'image', 'mimes:jpg,jpeg,png', 'max:5120'],
|
||||
'items' => ['required', 'array', 'min:1'],
|
||||
'items.*.item' => ['required', 'max:255'],
|
||||
'items.*.kuantiti' => ['required', 'integer', 'min:1'],
|
||||
'items.*.harga_anggaran' => ['required', 'numeric', 'min:0'],
|
||||
]);
|
||||
}
|
||||
|
||||
private function storeImage(Request $request, string $field): ?string
|
||||
{
|
||||
return $request->hasFile($field) ? $request->file($field)->store('permohonan', 'public') : null;
|
||||
}
|
||||
|
||||
private function authorizeOwner(Permohonan $permohonan): void
|
||||
{
|
||||
abort_unless($permohonan->user_id === auth()->id() || auth()->user()->hasAnyRole(['Admin', 'Pelaksana']), 403);
|
||||
}
|
||||
}
|
||||
26
app/Http/Controllers/ProfileController.php
Normal file
26
app/Http/Controllers/ProfileController.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
public function edit()
|
||||
{
|
||||
return view('profile.edit');
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'name' => ['required', 'max:255'],
|
||||
'no_telefon' => ['nullable', 'max:30'],
|
||||
'jawatan' => ['nullable', 'max:255'],
|
||||
]);
|
||||
|
||||
$request->user()->update($validated);
|
||||
|
||||
return back()->with('success', 'Profil berjaya dikemaskini.');
|
||||
}
|
||||
}
|
||||
22
app/Http/Middleware/EnsureUserIsActive.php
Normal file
22
app/Http/Middleware/EnsureUserIsActive.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class EnsureUserIsActive
|
||||
{
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if (Auth::check() && ! Auth::user()->status) {
|
||||
Auth::logout();
|
||||
|
||||
return redirect()->route('login')->withErrors(['email' => 'Akaun anda tidak aktif.']);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
38
app/Models/Jabatan.php
Normal file
38
app/Models/Jabatan.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
|
||||
class Jabatan extends Model
|
||||
{
|
||||
use HasFactory, LogsActivity, SoftDeletes;
|
||||
|
||||
protected $table = 'jabatan';
|
||||
|
||||
protected $fillable = ['nama', 'peringkat', 'kod', 'penerangan', 'status'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['status' => 'boolean'];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()->logFillable()->logOnlyDirty();
|
||||
}
|
||||
|
||||
public function vot()
|
||||
{
|
||||
return $this->hasMany(Vot::class, 'jabatan_id');
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany(User::class, 'jabatan_id');
|
||||
}
|
||||
}
|
||||
44
app/Models/Permohonan.php
Normal file
44
app/Models/Permohonan.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
|
||||
class Permohonan extends Model
|
||||
{
|
||||
use HasFactory, LogsActivity;
|
||||
|
||||
protected $table = 'permohonan';
|
||||
|
||||
protected $fillable = [
|
||||
'no_rujukan', 'user_id', 'jabatan_id', 'vot_id', 'kategori', 'tujuan',
|
||||
'jumlah_keseluruhan', 'status', 'catatan', 'gambar_1', 'gambar_2',
|
||||
'status_semakan', 'catatan_semakan', 'reviewed_by', 'reviewed_at',
|
||||
'approved_by', 'approved_at', 'submitted_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'jumlah_keseluruhan' => 'decimal:2',
|
||||
'submitted_at' => 'datetime',
|
||||
'reviewed_at' => 'datetime',
|
||||
'approved_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()->logFillable()->logOnlyDirty();
|
||||
}
|
||||
|
||||
public function user() { return $this->belongsTo(User::class); }
|
||||
public function jabatan() { return $this->belongsTo(Jabatan::class, 'jabatan_id'); }
|
||||
public function vot() { return $this->belongsTo(Vot::class, 'vot_id'); }
|
||||
public function items() { return $this->hasMany(PermohonanItem::class, 'permohonan_id'); }
|
||||
public function reviewer() { return $this->belongsTo(User::class, 'reviewed_by'); }
|
||||
public function approver() { return $this->belongsTo(User::class, 'approved_by'); }
|
||||
}
|
||||
26
app/Models/PermohonanItem.php
Normal file
26
app/Models/PermohonanItem.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PermohonanItem extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'permohonan_id', 'item', 'kuantiti', 'harga_anggaran', 'jumlah',
|
||||
'status_item', 'catatan_pelaksana',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['harga_anggaran' => 'decimal:2', 'jumlah' => 'decimal:2'];
|
||||
}
|
||||
|
||||
public function permohonan()
|
||||
{
|
||||
return $this->belongsTo(Permohonan::class, 'permohonan_id');
|
||||
}
|
||||
}
|
||||
67
app/Models/User.php
Normal file
67
app/Models/User.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Database\Factories\UserFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
/** @use HasFactory<UserFactory> */
|
||||
use HasFactory, HasRoles, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'no_telefon',
|
||||
'jawatan',
|
||||
'jabatan_id',
|
||||
'status',
|
||||
'last_login_at',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'last_login_at' => 'datetime',
|
||||
'status' => 'boolean',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
|
||||
public function jabatan()
|
||||
{
|
||||
return $this->belongsTo(Jabatan::class, 'jabatan_id');
|
||||
}
|
||||
|
||||
public function permohonan()
|
||||
{
|
||||
return $this->hasMany(Permohonan::class);
|
||||
}
|
||||
}
|
||||
32
app/Models/Vot.php
Normal file
32
app/Models/Vot.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Activitylog\LogOptions;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
|
||||
class Vot extends Model
|
||||
{
|
||||
use HasFactory, LogsActivity;
|
||||
|
||||
protected $table = 'vot';
|
||||
|
||||
protected $fillable = ['kod', 'nama', 'jabatan_id', 'penerangan', 'status'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['status' => 'boolean'];
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()->logFillable()->logOnlyDirty();
|
||||
}
|
||||
|
||||
public function jabatan()
|
||||
{
|
||||
return $this->belongsTo(Jabatan::class, 'jabatan_id');
|
||||
}
|
||||
}
|
||||
24
app/Providers/AppServiceProvider.php
Normal file
24
app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
18
artisan
Normal file
18
artisan
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
// Bootstrap Laravel and handle the command...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||
|
||||
$status = $app->handleCommand(new ArgvInput);
|
||||
|
||||
exit($status);
|
||||
22
bootstrap/app.php
Normal file
22
bootstrap/app.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
health: '/up',
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware): void {
|
||||
$middleware->alias([
|
||||
'role' => \Spatie\Permission\Middleware\RoleMiddleware::class,
|
||||
'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class,
|
||||
'active' => \App\Http\Middleware\EnsureUserIsActive::class,
|
||||
]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions): void {
|
||||
//
|
||||
})->create();
|
||||
2
bootstrap/cache/.gitignore
vendored
Normal file
2
bootstrap/cache/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
7
bootstrap/providers.php
Normal file
7
bootstrap/providers.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Providers\AppServiceProvider;
|
||||
|
||||
return [
|
||||
AppServiceProvider::class,
|
||||
];
|
||||
91
composer.json
Normal file
91
composer.json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"$schema": "https://getcomposer.org/schema.json",
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The skeleton application for the Laravel framework.",
|
||||
"keywords": ["laravel", "framework"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/tinker": "^2.10.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-dompdf": "^3.1",
|
||||
"fakerphp/faker": "^1.23",
|
||||
"laravel/breeze": "^2.4",
|
||||
"laravel/pail": "^1.2.2",
|
||||
"laravel/pint": "^1.24",
|
||||
"laravel/sail": "^1.41",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.6",
|
||||
"phpunit/phpunit": "^11.5.50",
|
||||
"spatie/laravel-activitylog": "^4.12",
|
||||
"spatie/laravel-permission": "^7.4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"setup": [
|
||||
"composer install",
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
|
||||
"@php artisan key:generate",
|
||||
"@php artisan migrate --force",
|
||||
"npm install",
|
||||
"npm run build"
|
||||
],
|
||||
"dev": [
|
||||
"Composer\\Config::disableProcessTimeout",
|
||||
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
|
||||
],
|
||||
"test": [
|
||||
"@php artisan config:clear --ansi",
|
||||
"@php artisan test"
|
||||
],
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi",
|
||||
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
|
||||
"@php artisan migrate --graceful --ansi"
|
||||
],
|
||||
"pre-package-uninstall": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
9820
composer.lock
generated
Normal file
9820
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
52
config/activitylog.php
Normal file
52
config/activitylog.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
* If set to false, no activities will be saved to the database.
|
||||
*/
|
||||
'enabled' => env('ACTIVITY_LOGGER_ENABLED', true),
|
||||
|
||||
/*
|
||||
* When the clean-command is executed, all recording activities older than
|
||||
* the number of days specified here will be deleted.
|
||||
*/
|
||||
'delete_records_older_than_days' => 365,
|
||||
|
||||
/*
|
||||
* If no log name is passed to the activity() helper
|
||||
* we use this default log name.
|
||||
*/
|
||||
'default_log_name' => 'default',
|
||||
|
||||
/*
|
||||
* You can specify an auth driver here that gets user models.
|
||||
* If this is null we'll use the current Laravel auth driver.
|
||||
*/
|
||||
'default_auth_driver' => null,
|
||||
|
||||
/*
|
||||
* If set to true, the subject returns soft deleted models.
|
||||
*/
|
||||
'subject_returns_soft_deleted_models' => false,
|
||||
|
||||
/*
|
||||
* This model will be used to log activity.
|
||||
* It should implement the Spatie\Activitylog\Contracts\Activity interface
|
||||
* and extend Illuminate\Database\Eloquent\Model.
|
||||
*/
|
||||
'activity_model' => \Spatie\Activitylog\Models\Activity::class,
|
||||
|
||||
/*
|
||||
* This is the name of the table that will be created by the migration and
|
||||
* used by the Activity model shipped with this package.
|
||||
*/
|
||||
'table_name' => env('ACTIVITY_LOGGER_TABLE_NAME', 'activity_log'),
|
||||
|
||||
/*
|
||||
* This is the database connection that will be used by the migration and
|
||||
* the Activity model shipped with this package. In case it's not set
|
||||
* Laravel's database.default will be used instead.
|
||||
*/
|
||||
'database_connection' => env('ACTIVITY_LOGGER_DB_CONNECTION'),
|
||||
];
|
||||
126
config/app.php
Normal file
126
config/app.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application, which will be used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| other UI elements where an application name needs to be displayed.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| the application so that it's available within Artisan commands.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. The timezone
|
||||
| is set to "UTC" by default as it is suitable for most use cases.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by Laravel's translation / localization methods. This option can be
|
||||
| set to any locale for which you plan to have translation strings.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => env('APP_LOCALE', 'en'),
|
||||
|
||||
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||
|
||||
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is utilized by Laravel's encryption services and should be set
|
||||
| to a random, 32 character string to ensure that all encrypted values
|
||||
| are secure. You should do this prior to deploying the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'previous_keys' => [
|
||||
...array_filter(
|
||||
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
|
||||
),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
||||
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
||||
],
|
||||
|
||||
];
|
||||
117
config/auth.php
Normal file
117
config/auth.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default authentication "guard" and password
|
||||
| reset "broker" for your application. You may change these values
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => env('AUTH_GUARD', 'web'),
|
||||
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| which utilizes session storage plus the Eloquent user provider.
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| Supported: "session"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| providers to represent the model / table. These providers may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => env('AUTH_MODEL', User::class),
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options specify the behavior of Laravel's password
|
||||
| reset functionality, including the table utilized for token storage
|
||||
| and the user provider that is invoked to actually retrieve users.
|
||||
|
|
||||
| The expiry time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
| The throttle setting is the number of seconds a user must wait before
|
||||
| generating more password reset tokens. This prevents the user from
|
||||
| quickly generating a very large amount of password reset tokens.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the number of seconds before a password confirmation
|
||||
| window expires and users are asked to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
|
||||
|
||||
];
|
||||
117
config/cache.php
Normal file
117
config/cache.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache store that will be used by the
|
||||
| framework. This connection is utilized if another isn't explicitly
|
||||
| specified when running a cache operation inside the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_STORE', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "array", "database", "file", "memcached",
|
||||
| "redis", "dynamodb", "octane",
|
||||
| "failover", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_CACHE_CONNECTION'),
|
||||
'table' => env('DB_CACHE_TABLE', 'cache'),
|
||||
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
|
||||
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
'lock_path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
|
||||
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'driver' => 'failover',
|
||||
'stores' => [
|
||||
'database',
|
||||
'array',
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
|
||||
| stores, there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
|
||||
|
||||
];
|
||||
184
config/database.php
Normal file
184
config/database.php
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Pdo\Mysql;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for database operations. This is
|
||||
| the connection which will be utilized unless another connection
|
||||
| is explicitly specified when you execute a query / statement.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'sqlite'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below are all of the database connections defined for your application.
|
||||
| An example configuration is provided for each database system which
|
||||
| is supported by Laravel. You're free to add / remove connections.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DB_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
'busy_timeout' => null,
|
||||
'journal_mode' => null,
|
||||
'synchronous' => null,
|
||||
'transaction_mode' => 'DEFERRED',
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'mariadb' => [
|
||||
'driver' => 'mariadb',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
(PHP_VERSION_ID >= 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'search_path' => 'public',
|
||||
'sslmode' => env('DB_SSLMODE', 'prefer'),
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run on the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => [
|
||||
'table' => 'migrations',
|
||||
'update_date_on_publish' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as Memcached. You may define your connection settings here.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
|
||||
'persistent' => env('REDIS_PERSISTENT', false),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
'max_retries' => env('REDIS_MAX_RETRIES', 3),
|
||||
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
|
||||
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
|
||||
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
80
config/filesystems.php
Normal file
80
config/filesystems.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application for file storage.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below you may configure as many filesystem disks as necessary, and you
|
||||
| may even configure multiple disks for the same driver. Examples for
|
||||
| most supported storage drivers are configured here for reference.
|
||||
|
|
||||
| Supported drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/private'),
|
||||
'serve' => true,
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
||||
132
config/logging.php
Normal file
132
config/logging.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
use Monolog\Processor\PsrLogMessageProcessor;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that is utilized to write
|
||||
| messages to your logs. The value provided here should match one of
|
||||
| the channels present in the list of "channels" configured below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Laravel
|
||||
| utilizes the Monolog PHP logging library, which includes a variety
|
||||
| of powerful log handlers and formatters that you're free to use.
|
||||
|
|
||||
| Available drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog", "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => env('LOG_DAILY_DAYS', 14),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => env('LOG_SLACK_USERNAME', env('APP_NAME', 'Laravel')),
|
||||
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'handler_with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
118
config/mail.php
Normal file
118
config/mail.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send all email
|
||||
| messages unless another mailer is explicitly specified when sending
|
||||
| the message. All additional mailers can be configured within the
|
||||
| "mailers" array. Examples of each type of mailer are provided.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'log'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers that can be used
|
||||
| when delivering an email. You may specify which one you're using for
|
||||
| your mailers below. You may also add additional mailers if needed.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||
| "postmark", "resend", "log", "array",
|
||||
| "failover", "roundrobin"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'scheme' => env('MAIL_SCHEME'),
|
||||
'url' => env('MAIL_URL'),
|
||||
'host' => env('MAIL_HOST', '127.0.0.1'),
|
||||
'port' => env('MAIL_PORT', 2525),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'transport' => 'resend',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
'retry_after' => 60,
|
||||
],
|
||||
|
||||
'roundrobin' => [
|
||||
'transport' => 'roundrobin',
|
||||
'mailers' => [
|
||||
'ses',
|
||||
'postmark',
|
||||
],
|
||||
'retry_after' => 60,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all emails sent by your application to be sent from
|
||||
| the same address. Here you may specify a name and address that is
|
||||
| used globally for all emails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Laravel')),
|
||||
],
|
||||
|
||||
];
|
||||
219
config/permission.php
Normal file
219
config/permission.php
Normal file
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
|
||||
use Spatie\Permission\DefaultTeamResolver;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
return [
|
||||
|
||||
'models' => [
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your permissions. Of course, it
|
||||
* is often just the "Permission" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Permission model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Permission` contract.
|
||||
*/
|
||||
|
||||
'permission' => Permission::class,
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your roles. Of course, it
|
||||
* is often just the "Role" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Role model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Role` contract.
|
||||
*/
|
||||
|
||||
'role' => Role::class,
|
||||
|
||||
/*
|
||||
* When using the "Teams" feature from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your teams. Of course, it
|
||||
* is often just the "Team" model but you may use whatever you like.
|
||||
*/
|
||||
'team' => null,
|
||||
|
||||
/*
|
||||
* When using the "HasModels" trait and passing raw IDs to syncModels,
|
||||
* attachModels, or detachModels, this model class will be used to
|
||||
* resolve those IDs. If null, defaults to the guard's model.
|
||||
*/
|
||||
'default_model' => null,
|
||||
],
|
||||
|
||||
'table_names' => [
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'roles' => 'roles',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your permissions. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'permissions' => 'permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_permissions' => 'model_has_permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models roles. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_roles' => 'model_has_roles',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'role_has_permissions' => 'role_has_permissions',
|
||||
],
|
||||
|
||||
'column_names' => [
|
||||
/*
|
||||
* Change this if you want to name the related pivots other than defaults
|
||||
*/
|
||||
'role_pivot_key' => null, // default 'role_id',
|
||||
'permission_pivot_key' => null, // default 'permission_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to name the related model primary key other than
|
||||
* `model_id`.
|
||||
*
|
||||
* For example, this would be nice if your primary keys are all UUIDs. In
|
||||
* that case, name this `model_uuid`.
|
||||
*/
|
||||
|
||||
'model_morph_key' => 'model_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to use the teams feature and your related model's
|
||||
* foreign key is other than `team_id`.
|
||||
*/
|
||||
|
||||
'team_foreign_key' => 'team_id',
|
||||
],
|
||||
|
||||
/*
|
||||
* When set to true, the method for checking permissions will be registered on the gate.
|
||||
* Set this to false if you want to implement custom logic for checking permissions.
|
||||
*/
|
||||
|
||||
'register_permission_check_method' => true,
|
||||
|
||||
/*
|
||||
* When set to true, Laravel\Octane\Events\OperationTerminated event listener will be registered
|
||||
* this will refresh permissions on every TickTerminated, TaskTerminated and RequestTerminated
|
||||
* NOTE: This should not be needed in most cases, but an Octane/Vapor combination benefited from it.
|
||||
*/
|
||||
'register_octane_reset_listener' => false,
|
||||
|
||||
/*
|
||||
* Events will fire when a role or permission is assigned/unassigned:
|
||||
* \Spatie\Permission\Events\RoleAttachedEvent
|
||||
* \Spatie\Permission\Events\RoleDetachedEvent
|
||||
* \Spatie\Permission\Events\PermissionAttachedEvent
|
||||
* \Spatie\Permission\Events\PermissionDetachedEvent
|
||||
*
|
||||
* To enable, set to true, and then create listeners to watch these events.
|
||||
*/
|
||||
'events_enabled' => false,
|
||||
|
||||
/*
|
||||
* Teams Feature.
|
||||
* When set to true the package implements teams using the 'team_foreign_key'.
|
||||
* If you want the migrations to register the 'team_foreign_key', you must
|
||||
* set this to true before doing the migration.
|
||||
* If you already did the migration then you must make a new migration to also
|
||||
* add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions'
|
||||
* (view the latest version of this package's migration file)
|
||||
*/
|
||||
|
||||
'teams' => false,
|
||||
|
||||
/*
|
||||
* The class to use to resolve the permissions team id
|
||||
*/
|
||||
'team_resolver' => DefaultTeamResolver::class,
|
||||
|
||||
/*
|
||||
* Passport Client Credentials Grant
|
||||
* When set to true the package will use Passports Client to check permissions
|
||||
*/
|
||||
|
||||
'use_passport_client_credentials' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required permission names are added to exception messages.
|
||||
* This could be considered an information leak in some contexts, so the default
|
||||
* setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_permission_in_exception' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required role names are added to exception messages.
|
||||
* This could be considered an information leak in some contexts, so the default
|
||||
* setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_role_in_exception' => false,
|
||||
|
||||
/*
|
||||
* By default wildcard permission lookups are disabled.
|
||||
* See documentation to understand supported syntax.
|
||||
*/
|
||||
|
||||
'enable_wildcard_permission' => false,
|
||||
|
||||
/*
|
||||
* The class to use for interpreting wildcard permissions.
|
||||
* If you need to modify delimiters, override the class and specify its name here.
|
||||
*/
|
||||
// 'wildcard_permission' => Spatie\Permission\WildcardPermission::class,
|
||||
|
||||
/* Cache-specific settings */
|
||||
|
||||
'cache' => [
|
||||
|
||||
/*
|
||||
* By default all permissions are cached for 24 hours to speed up performance.
|
||||
* When permissions or roles are updated the cache is flushed automatically.
|
||||
*/
|
||||
|
||||
'expiration_time' => DateInterval::createFromDateString('24 hours'),
|
||||
|
||||
/*
|
||||
* The cache key used to store all permissions.
|
||||
*/
|
||||
|
||||
'key' => 'spatie.permission.cache',
|
||||
|
||||
/*
|
||||
* You may optionally indicate a specific cache driver to use for permission and
|
||||
* role caching using any of the `store` drivers listed in the cache.php config
|
||||
* file. Using 'default' here means to use the `default` set in cache.php.
|
||||
*/
|
||||
|
||||
'store' => 'default',
|
||||
],
|
||||
];
|
||||
129
config/queue.php
Normal file
129
config/queue.php
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue supports a variety of backends via a single, unified
|
||||
| API, giving you convenient access to each backend using identical
|
||||
| syntax for each. The default queue connection is defined below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection options for every queue backend
|
||||
| used by your application. An example configuration is provided for
|
||||
| each backend supported by Laravel. You're also free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis",
|
||||
| "deferred", "background", "failover", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_QUEUE_CONNECTION'),
|
||||
'table' => env('DB_QUEUE_TABLE', 'jobs'),
|
||||
'queue' => env('DB_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
|
||||
'queue' => env('BEANSTALKD_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => 0,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'default'),
|
||||
'suffix' => env('SQS_SUFFIX'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => null,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'deferred' => [
|
||||
'driver' => 'deferred',
|
||||
],
|
||||
|
||||
'background' => [
|
||||
'driver' => 'background',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'driver' => 'failover',
|
||||
'connections' => [
|
||||
'database',
|
||||
'deferred',
|
||||
],
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Job Batching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following options configure the database and table that store job
|
||||
| batching information. These options can be updated to any database
|
||||
| connection and table which has been defined by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'batching' => [
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'job_batches',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control how and where failed jobs are stored. Laravel ships with
|
||||
| support for storing failed jobs in a simple file or in a database.
|
||||
|
|
||||
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
||||
38
config/services.php
Normal file
38
config/services.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'postmark' => [
|
||||
'key' => env('POSTMARK_API_KEY'),
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'key' => env('RESEND_API_KEY'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'notifications' => [
|
||||
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
217
config/session.php
Normal file
217
config/session.php
Normal file
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines the default session driver that is utilized for
|
||||
| incoming requests. Laravel supports a variety of storage options to
|
||||
| persist session data. Database storage is a great default choice.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "memcached",
|
||||
| "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to expire immediately when the browser is closed then you may
|
||||
| indicate that via the expire_on_close configuration option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => (int) env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it's stored. All encryption is performed
|
||||
| automatically by Laravel and you may use the session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => env('SESSION_ENCRYPT', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the "file" session driver, the session files are placed
|
||||
| on disk. The default storage location is defined here; however, you
|
||||
| are free to provide another location where they should be stored.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table to
|
||||
| be used to store sessions. Of course, a sensible default is defined
|
||||
| for you; however, you're welcome to change this to another table.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => env('SESSION_TABLE', 'sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using one of the framework's cache driven session backends, you may
|
||||
| define the cache store which should be used to store the session data
|
||||
| between requests. This must match one of your defined cache stores.
|
||||
|
|
||||
| Affects: "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the session cookie that is created by
|
||||
| the framework. Typically, you should not need to change this value
|
||||
| since doing so does not grant a meaningful security improvement.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application, but you're free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => env('SESSION_PATH', '/'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the domain and subdomains the session cookie is
|
||||
| available to. By default, the cookie will be available to the root
|
||||
| domain without subdomains. Typically, this shouldn't be changed.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. It's unlikely you should disable this option.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => env('SESSION_HTTP_ONLY', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" to permit secure cross-site requests.
|
||||
|
|
||||
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => env('SESSION_SAME_SITE', 'lax'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Partitioned Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will tie the cookie to the top-level site for
|
||||
| a cross-site context. Partitioned cookies are accepted by the browser
|
||||
| when flagged "secure" and the Same-Site attribute is set to "none".
|
||||
|
|
||||
*/
|
||||
|
||||
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
|
||||
|
||||
];
|
||||
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
46
database/factories/UserFactory.php
Normal file
46
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
/**
|
||||
* @extends Factory<User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'no_telefon' => fake()->phoneNumber(),
|
||||
'jawatan' => fake()->jobTitle(),
|
||||
'status' => true,
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
54
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
54
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('jabatan_id')->nullable()->index();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->string('no_telefon')->nullable();
|
||||
$table->string('jawatan')->nullable();
|
||||
$table->boolean('status')->default(true);
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->timestamp('last_login_at')->nullable();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration')->index();
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jabatan', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nama');
|
||||
$table->enum('peringkat', ['Jabatan', 'Bahagian', 'Seksyen', 'Unit', 'Sub Unit']);
|
||||
$table->string('kod')->nullable()->unique();
|
||||
$table->text('penerangan')->nullable();
|
||||
$table->boolean('status')->default(true);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jabatan');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->foreign('jabatan_id')->references('id')->on('jabatan')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropForeign(['jabatan_id']);
|
||||
});
|
||||
}
|
||||
};
|
||||
26
database/migrations/2026_05_13_030010_create_vot_table.php
Normal file
26
database/migrations/2026_05_13_030010_create_vot_table.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('vot', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('jabatan_id')->nullable()->constrained('jabatan')->nullOnDelete();
|
||||
$table->string('kod')->unique();
|
||||
$table->string('nama');
|
||||
$table->text('penerangan')->nullable();
|
||||
$table->boolean('status')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('vot');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('permohonan', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('no_rujukan')->unique();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('jabatan_id')->nullable()->constrained('jabatan')->nullOnDelete();
|
||||
$table->foreignId('vot_id')->nullable()->constrained('vot')->nullOnDelete();
|
||||
$table->string('kategori');
|
||||
$table->text('tujuan');
|
||||
$table->decimal('jumlah_keseluruhan', 14, 2)->default(0);
|
||||
$table->enum('status', ['Draft', 'Submitted', 'Under Review', 'Accepted', 'Rejected', 'Approved'])->default('Draft');
|
||||
$table->text('catatan')->nullable();
|
||||
$table->string('gambar_1')->nullable();
|
||||
$table->string('gambar_2')->nullable();
|
||||
$table->enum('status_semakan', ['Belum Disemak', 'Sedang Disemak', 'Selesai'])->default('Belum Disemak');
|
||||
$table->text('catatan_semakan')->nullable();
|
||||
$table->foreignId('reviewed_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('reviewed_at')->nullable();
|
||||
$table->foreignId('approved_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('approved_at')->nullable();
|
||||
$table->timestamp('submitted_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('permohonan');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('permohonan_items', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('permohonan_id')->constrained('permohonan')->cascadeOnDelete();
|
||||
$table->string('item');
|
||||
$table->integer('kuantiti');
|
||||
$table->decimal('harga_anggaran', 14, 2);
|
||||
$table->decimal('jumlah', 14, 2);
|
||||
$table->enum('status_item', ['Pending', 'Accepted', 'Rejected', 'Partial Accept'])->default('Pending');
|
||||
$table->text('catatan_pelaksana')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('permohonan_items');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateActivityLogTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->create(config('activitylog.table_name'), function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('log_name')->nullable();
|
||||
$table->text('description');
|
||||
$table->nullableMorphs('subject', 'subject');
|
||||
$table->nullableMorphs('causer', 'causer');
|
||||
$table->json('properties')->nullable();
|
||||
$table->timestamps();
|
||||
$table->index('log_name');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$teams = config('permission.teams');
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
|
||||
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
|
||||
|
||||
throw_if(empty($tableNames), 'Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
throw_if($teams && empty($columnNames['team_foreign_key'] ?? null), 'Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
|
||||
/**
|
||||
* See `docs/prerequisites.md` for suggested lengths on 'name' and 'guard_name' if "1071 Specified key was too long" errors are encountered.
|
||||
*/
|
||||
Schema::create($tableNames['permissions'], static function (Blueprint $table) {
|
||||
$table->id(); // permission id
|
||||
$table->string('name');
|
||||
$table->string('guard_name');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
/**
|
||||
* See `docs/prerequisites.md` for suggested lengths on 'name' and 'guard_name' if "1071 Specified key was too long" errors are encountered.
|
||||
*/
|
||||
Schema::create($tableNames['roles'], static function (Blueprint $table) use ($teams, $columnNames) {
|
||||
$table->id(); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name');
|
||||
$table->string('guard_name');
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->cascadeOnDelete();
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->cascadeOnDelete();
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], static function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
throw_if(empty($tableNames), 'Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
|
||||
Schema::dropIfExists($tableNames['role_has_permissions']);
|
||||
Schema::dropIfExists($tableNames['model_has_roles']);
|
||||
Schema::dropIfExists($tableNames['model_has_permissions']);
|
||||
Schema::dropIfExists($tableNames['roles']);
|
||||
Schema::dropIfExists($tableNames['permissions']);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddEventColumnToActivityLogTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||
$table->string('event')->nullable()->after('subject_type');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||
$table->dropColumn('event');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddBatchUuidColumnToActivityLogTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||
$table->uuid('batch_uuid')->nullable()->after('properties');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->table(config('activitylog.table_name'), function (Blueprint $table) {
|
||||
$table->dropColumn('batch_uuid');
|
||||
});
|
||||
}
|
||||
}
|
||||
94
database/seeders/DatabaseSeeder.php
Normal file
94
database/seeders/DatabaseSeeder.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Jabatan;
|
||||
use App\Models\Permohonan;
|
||||
use App\Models\User;
|
||||
use App\Models\Vot;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
|
||||
$permissions = [
|
||||
'manage configuration', 'manage users', 'manage roles', 'create permohonan',
|
||||
'review permohonan', 'approve permohonan', 'view reports', 'export reports',
|
||||
];
|
||||
foreach ($permissions as $permission) {
|
||||
Permission::firstOrCreate(['name' => $permission, 'guard_name' => 'web']);
|
||||
}
|
||||
|
||||
$adminRole = Role::firstOrCreate(['name' => 'Admin', 'guard_name' => 'web']);
|
||||
$pelaksanaRole = Role::firstOrCreate(['name' => 'Pelaksana', 'guard_name' => 'web']);
|
||||
$pemohonRole = Role::firstOrCreate(['name' => 'Pemohon', 'guard_name' => 'web']);
|
||||
$adminRole->syncPermissions($permissions);
|
||||
$pelaksanaRole->syncPermissions(['review permohonan', 'view reports']);
|
||||
$pemohonRole->syncPermissions(['create permohonan']);
|
||||
|
||||
$jabatan = collect([
|
||||
['kod' => 'KEW', 'nama' => 'Jabatan Kewangan', 'peringkat' => 'Jabatan', 'penerangan' => 'Pengurusan kewangan dan bajet MBIP'],
|
||||
['kod' => 'ICT', 'nama' => 'Bahagian Teknologi Maklumat', 'peringkat' => 'Bahagian', 'penerangan' => 'Perkhidmatan digital dan infrastruktur ICT'],
|
||||
['kod' => 'KORP', 'nama' => 'Jabatan Korporat', 'peringkat' => 'Jabatan', 'penerangan' => 'Komunikasi korporat dan pentadbiran'],
|
||||
])->map(fn ($row) => Jabatan::firstOrCreate(['kod' => $row['kod']], $row));
|
||||
|
||||
$vot = collect([
|
||||
['kod' => '21000', 'nama' => 'Bekalan Pejabat', 'jabatan_id' => $jabatan[0]->id],
|
||||
['kod' => '24000', 'nama' => 'Penyelenggaraan Sistem', 'jabatan_id' => $jabatan[1]->id],
|
||||
['kod' => '27000', 'nama' => 'Program Korporat', 'jabatan_id' => $jabatan[2]->id],
|
||||
])->map(fn ($row) => Vot::firstOrCreate(['kod' => $row['kod']], $row + ['status' => true]));
|
||||
|
||||
$admin = User::firstOrCreate(['email' => 'admin@mbip.gov.my'], [
|
||||
'name' => 'Admin Kewangan',
|
||||
'password' => Hash::make('password'),
|
||||
'jabatan_id' => $jabatan[0]->id,
|
||||
'jawatan' => 'Akauntan',
|
||||
'no_telefon' => '07-5550001',
|
||||
'status' => true,
|
||||
]);
|
||||
$admin->syncRoles('Admin');
|
||||
|
||||
$pelaksana = User::firstOrCreate(['email' => 'pelaksana@mbip.gov.my'], [
|
||||
'name' => 'Pegawai Pelaksana',
|
||||
'password' => Hash::make('password'),
|
||||
'jabatan_id' => $jabatan[1]->id,
|
||||
'jawatan' => 'Pegawai Penyemak Bajet',
|
||||
'no_telefon' => '07-5550002',
|
||||
'status' => true,
|
||||
]);
|
||||
$pelaksana->syncRoles('Pelaksana');
|
||||
|
||||
$pemohon = User::firstOrCreate(['email' => 'pemohon@mbip.gov.my'], [
|
||||
'name' => 'Pegawai Pemohon',
|
||||
'password' => Hash::make('password'),
|
||||
'jabatan_id' => $jabatan[1]->id,
|
||||
'jawatan' => 'Penolong Pegawai Teknologi Maklumat',
|
||||
'no_telefon' => '07-5550003',
|
||||
'status' => true,
|
||||
]);
|
||||
$pemohon->syncRoles('Pemohon');
|
||||
|
||||
$permohonan = Permohonan::firstOrCreate(['no_rujukan' => 'MBIP/BJT/DEMO/001'], [
|
||||
'user_id' => $pemohon->id,
|
||||
'jabatan_id' => $jabatan[1]->id,
|
||||
'vot_id' => $vot[1]->id,
|
||||
'kategori' => 'Penyelenggaraan',
|
||||
'tujuan' => 'Penyelenggaraan lesen dan sokongan sistem dalaman.',
|
||||
'status' => 'Submitted',
|
||||
'submitted_at' => now(),
|
||||
'jumlah_keseluruhan' => 12500,
|
||||
]);
|
||||
if ($permohonan->items()->count() === 0) {
|
||||
$permohonan->items()->createMany([
|
||||
['item' => 'Lesen sistem helpdesk', 'kuantiti' => 10, 'harga_anggaran' => 850, 'jumlah' => 8500],
|
||||
['item' => 'Sokongan teknikal tahunan', 'kuantiti' => 1, 'harga_anggaran' => 4000, 'jumlah' => 4000],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
17
package.json
Normal file
17
package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"$schema": "https://www.schemastore.org/package.json",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"dev": "vite"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"axios": "^1.11.0",
|
||||
"concurrently": "^9.0.1",
|
||||
"laravel-vite-plugin": "^2.0.0",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"vite": "^7.0.7"
|
||||
}
|
||||
}
|
||||
36
phpunit.xml
Normal file
36
phpunit.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory>tests/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory>tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<source>
|
||||
<include>
|
||||
<directory>app</directory>
|
||||
</include>
|
||||
</source>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="BROADCAST_CONNECTION" value="null"/>
|
||||
<env name="CACHE_STORE" value="array"/>
|
||||
<env name="DB_CONNECTION" value="sqlite"/>
|
||||
<env name="DB_DATABASE" value=":memory:"/>
|
||||
<env name="DB_URL" value=""/>
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="PULSE_ENABLED" value="false"/>
|
||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||
<env name="NIGHTWATCH_ENABLED" value="false"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
25
public/.htaccess
Normal file
25
public/.htaccess
Normal file
@@ -0,0 +1,25 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Handle X-XSRF-Token Header
|
||||
RewriteCond %{HTTP:x-xsrf-token} .
|
||||
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Send Requests To Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
0
public/favicon.ico
Normal file
0
public/favicon.ico
Normal file
20
public/index.php
Normal file
20
public/index.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
// Determine if the application is in maintenance mode...
|
||||
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
|
||||
require $maintenance;
|
||||
}
|
||||
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
// Bootstrap Laravel and handle the request...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
$app->handleRequest(Request::capture());
|
||||
2
public/robots.txt
Normal file
2
public/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
11
resources/css/app.css
Normal file
11
resources/css/app.css
Normal file
@@ -0,0 +1,11 @@
|
||||
@import 'tailwindcss';
|
||||
|
||||
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
|
||||
@source '../../storage/framework/views/*.php';
|
||||
@source '../**/*.blade.php';
|
||||
@source '../**/*.js';
|
||||
|
||||
@theme {
|
||||
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
||||
'Segoe UI Symbol', 'Noto Color Emoji';
|
||||
}
|
||||
1
resources/js/app.js
Normal file
1
resources/js/app.js
Normal file
@@ -0,0 +1 @@
|
||||
import './bootstrap';
|
||||
4
resources/js/bootstrap.js
vendored
Normal file
4
resources/js/bootstrap.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import axios from 'axios';
|
||||
window.axios = axios;
|
||||
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
6
resources/views/admin/jabatan/form.blade.php
Normal file
6
resources/views/admin/jabatan/form.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', $jabatan->exists ? 'Edit Jabatan' : 'Tambah Jabatan')
|
||||
@section('content')
|
||||
<div class="card p-4 col-lg-8"><form method="POST" action="{{ $jabatan->exists ? route('jabatan.update',$jabatan) : route('jabatan.store') }}">@csrf @if($jabatan->exists) @method('PUT') @endif
|
||||
<div class="row g-3"><div class="col-md-8"><label class="form-label">Nama</label><input name="nama" class="form-control" value="{{ old('nama',$jabatan->nama) }}" required></div><div class="col-md-4"><label class="form-label">Kod</label><input name="kod" class="form-control" value="{{ old('kod',$jabatan->kod) }}"></div><div class="col-md-6"><label class="form-label">Peringkat</label><select name="peringkat" class="form-select" required>@foreach(['Jabatan','Bahagian','Seksyen','Unit','Sub Unit'] as $p)<option @selected(old('peringkat',$jabatan->peringkat)===$p)>{{ $p }}</option>@endforeach</select></div><div class="col-md-6 d-flex align-items-end"><label class="form-check"><input type="checkbox" name="status" value="1" class="form-check-input" @checked(old('status',$jabatan->status ?? true))> Aktif</label></div><div class="col-12"><label class="form-label">Penerangan</label><textarea name="penerangan" class="form-control">{{ old('penerangan',$jabatan->penerangan) }}</textarea></div></div><div class="mt-4"><button class="btn btn-primary">Simpan</button><a class="btn btn-light" href="{{ route('jabatan.index') }}">Kembali</a></div></form></div>
|
||||
@endsection
|
||||
6
resources/views/admin/jabatan/index.blade.php
Normal file
6
resources/views/admin/jabatan/index.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Konfigurasi Jabatan')
|
||||
@section('content')
|
||||
<div class="d-flex justify-content-between mb-3"><form class="d-flex gap-2"><input name="search" class="form-control" placeholder="Cari nama/kod" value="{{ request('search') }}"><select name="peringkat" class="form-select"><option value="">Semua peringkat</option>@foreach(['Jabatan','Bahagian','Seksyen','Unit','Sub Unit'] as $p)<option @selected(request('peringkat')===$p)>{{ $p }}</option>@endforeach</select><button class="btn btn-outline-primary"><i class="bi bi-search"></i></button></form><a href="{{ route('jabatan.create') }}" class="btn btn-primary"><i class="bi bi-plus-lg"></i> Jabatan</a></div>
|
||||
<div class="card p-3 table-responsive"><table class="table align-middle" data-datatable><thead><tr><th>Kod</th><th>Nama</th><th>Peringkat</th><th>Status</th><th></th></tr></thead><tbody>@foreach($jabatan as $j)<tr><td>{{ $j->kod }}</td><td>{{ $j->nama }}</td><td>{{ $j->peringkat }}</td><td><span class="badge text-bg-{{ $j->status ? 'success':'secondary' }}">{{ $j->status ? 'Aktif':'Tidak Aktif' }}</span></td><td class="text-end"><a class="btn btn-sm btn-outline-primary" href="{{ route('jabatan.edit',$j) }}"><i class="bi bi-pencil"></i></a><form class="d-inline" data-confirm method="POST" action="{{ route('jabatan.destroy',$j) }}">@csrf @method('DELETE')<button class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i></button></form></td></tr>@endforeach</tbody></table>{{ $jabatan->links() }}</div>
|
||||
@endsection
|
||||
6
resources/views/admin/roles/form.blade.php
Normal file
6
resources/views/admin/roles/form.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', $role->exists ? 'Edit Role' : 'Tambah Role')
|
||||
@section('content')
|
||||
<div class="card p-4 col-lg-8"><form method="POST" action="{{ $role->exists ? route('roles.update',$role) : route('roles.store') }}">@csrf @if($role->exists) @method('PUT') @endif
|
||||
<div class="mb-3"><label class="form-label">Nama Role</label><input name="name" class="form-control" value="{{ old('name',$role->name) }}" required></div><div class="row g-2">@foreach($permissions as $p)<div class="col-md-4"><label class="form-check"><input class="form-check-input" type="checkbox" name="permissions[]" value="{{ $p->name }}" @checked($role->permissions->contains('name',$p->name))> {{ $p->name }}</label></div>@endforeach</div><div class="mt-4"><button class="btn btn-primary">Simpan</button><a class="btn btn-light" href="{{ route('roles.index') }}">Kembali</a></div></form></div>
|
||||
@endsection
|
||||
6
resources/views/admin/roles/index.blade.php
Normal file
6
resources/views/admin/roles/index.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Role & Permission')
|
||||
@section('content')
|
||||
<div class="d-flex justify-content-end mb-3"><a class="btn btn-primary" href="{{ route('roles.create') }}"><i class="bi bi-plus-lg"></i> Role</a></div>
|
||||
<div class="card p-3 table-responsive"><table class="table align-middle"><thead><tr><th>Role</th><th>Permission</th><th></th></tr></thead><tbody>@foreach($roles as $r)<tr><td class="fw-semibold">{{ $r->name }}</td><td>@foreach($r->permissions as $p)<span class="badge text-bg-light border">{{ $p->name }}</span>@endforeach</td><td class="text-end"><a href="{{ route('roles.edit',$r) }}" class="btn btn-sm btn-outline-primary"><i class="bi bi-pencil"></i></a><form class="d-inline" method="POST" action="{{ route('roles.destroy',$r) }}" data-confirm>@csrf @method('DELETE')<button class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i></button></form></td></tr>@endforeach</tbody></table>{{ $roles->links() }}</div>
|
||||
@endsection
|
||||
6
resources/views/admin/users/form.blade.php
Normal file
6
resources/views/admin/users/form.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', $user->exists ? 'Edit User' : 'Tambah User')
|
||||
@section('content')
|
||||
<div class="card p-4 col-xl-9"><form method="POST" action="{{ $user->exists ? route('users.update',$user) : route('users.store') }}">@csrf @if($user->exists) @method('PUT') @endif
|
||||
<div class="row g-3"><div class="col-md-6"><label class="form-label">Nama</label><input name="name" class="form-control" value="{{ old('name',$user->name) }}" required></div><div class="col-md-6"><label class="form-label">Email</label><input name="email" type="email" class="form-control" value="{{ old('email',$user->email) }}" required></div><div class="col-md-6"><label class="form-label">No Telefon</label><input name="no_telefon" class="form-control" value="{{ old('no_telefon',$user->no_telefon) }}"></div><div class="col-md-6"><label class="form-label">Jawatan</label><input name="jawatan" class="form-control" value="{{ old('jawatan',$user->jawatan) }}"></div><div class="col-md-6"><label class="form-label">Jabatan</label><select name="jabatan_id" class="form-select"><option value="">Pilih Jabatan</option>@foreach($jabatan as $j)<option value="{{ $j->id }}" @selected(old('jabatan_id',$user->jabatan_id)==$j->id)>{{ $j->nama }}</option>@endforeach</select></div><div class="col-md-6"><label class="form-label">Role</label><select name="role" class="form-select"><option value="">Pilih Role</option>@foreach($roles as $r)<option value="{{ $r->name }}" @selected(old('role',$user->roles->first()?->name)===$r->name)>{{ $r->name }}</option>@endforeach</select></div><div class="col-md-6"><label class="form-label">Kata Laluan</label><input name="password" type="password" class="form-control" @required(!$user->exists)></div><div class="col-md-6"><label class="form-label">Sahkan Kata Laluan</label><input name="password_confirmation" type="password" class="form-control" @required(!$user->exists)></div><div class="col-12"><label class="form-check"><input type="checkbox" name="status" value="1" class="form-check-input" @checked(old('status',$user->status ?? true))> Aktif</label></div></div><div class="mt-4"><button class="btn btn-primary">Simpan</button><a class="btn btn-light" href="{{ route('users.index') }}">Kembali</a></div></form></div>
|
||||
@endsection
|
||||
6
resources/views/admin/users/index.blade.php
Normal file
6
resources/views/admin/users/index.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Pengurusan User')
|
||||
@section('content')
|
||||
<div class="d-flex justify-content-between mb-3"><form class="d-flex gap-2"><input name="search" class="form-control" placeholder="Cari user" value="{{ request('search') }}"><button class="btn btn-outline-primary"><i class="bi bi-search"></i></button></form><a class="btn btn-primary" href="{{ route('users.create') }}"><i class="bi bi-person-plus"></i> User</a></div>
|
||||
<div class="card p-3 table-responsive"><table class="table align-middle"><thead><tr><th>Nama</th><th>Email</th><th>Jabatan</th><th>Role</th><th>Status</th><th></th></tr></thead><tbody>@foreach($users as $u)<tr><td>{{ $u->name }}<div class="small text-muted">{{ $u->jawatan }}</div></td><td>{{ $u->email }}</td><td>{{ $u->jabatan?->nama }}</td><td>{{ $u->roles->pluck('name')->join(', ') }}</td><td><span class="badge text-bg-{{ $u->status ? 'success':'secondary' }}">{{ $u->status ? 'Aktif':'Tidak Aktif' }}</span></td><td class="text-end"><a class="btn btn-sm btn-outline-primary" href="{{ route('users.edit',$u) }}"><i class="bi bi-pencil"></i></a><form class="d-inline" method="POST" action="{{ route('users.reset-password',$u) }}" data-confirm>@csrf<button class="btn btn-sm btn-outline-warning"><i class="bi bi-key"></i></button></form><form class="d-inline" method="POST" action="{{ route('users.destroy',$u) }}" data-confirm>@csrf @method('DELETE')<button class="btn btn-sm btn-outline-secondary"><i class="bi bi-toggle2-on"></i></button></form></td></tr>@endforeach</tbody></table>{{ $users->links() }}</div>
|
||||
@endsection
|
||||
6
resources/views/admin/vot/form.blade.php
Normal file
6
resources/views/admin/vot/form.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', $vot->exists ? 'Edit VOT' : 'Tambah VOT')
|
||||
@section('content')
|
||||
<div class="card p-4 col-lg-8"><form method="POST" action="{{ $vot->exists ? route('vot.update',$vot) : route('vot.store') }}">@csrf @if($vot->exists) @method('PUT') @endif
|
||||
<div class="row g-3"><div class="col-md-4"><label class="form-label">Kod</label><input name="kod" class="form-control" value="{{ old('kod',$vot->kod) }}" required></div><div class="col-md-8"><label class="form-label">Nama</label><input name="nama" class="form-control" value="{{ old('nama',$vot->nama) }}" required></div><div class="col-md-8"><label class="form-label">Jabatan</label><select name="jabatan_id" class="form-select"><option value="">Pilih Jabatan</option>@foreach($jabatan as $j)<option value="{{ $j->id }}" @selected(old('jabatan_id',$vot->jabatan_id)==$j->id)>{{ $j->nama }}</option>@endforeach</select></div><div class="col-md-4 d-flex align-items-end"><label class="form-check"><input type="checkbox" name="status" value="1" class="form-check-input" @checked(old('status',$vot->status ?? true))> Aktif</label></div><div class="col-12"><label class="form-label">Penerangan</label><textarea name="penerangan" class="form-control">{{ old('penerangan',$vot->penerangan) }}</textarea></div></div><div class="mt-4"><button class="btn btn-primary">Simpan</button><a class="btn btn-light" href="{{ route('vot.index') }}">Kembali</a></div></form></div>
|
||||
@endsection
|
||||
6
resources/views/admin/vot/index.blade.php
Normal file
6
resources/views/admin/vot/index.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Konfigurasi VOT')
|
||||
@section('content')
|
||||
<div class="d-flex justify-content-between mb-3"><form class="d-flex gap-2"><input name="search" class="form-control" placeholder="Cari VOT" value="{{ request('search') }}"><select name="jabatan_id" class="form-select"><option value="">Semua jabatan</option>@foreach($jabatan as $j)<option value="{{ $j->id }}" @selected(request('jabatan_id')==$j->id)>{{ $j->nama }}</option>@endforeach</select><button class="btn btn-outline-primary"><i class="bi bi-search"></i></button></form><a href="{{ route('vot.create') }}" class="btn btn-primary"><i class="bi bi-plus-lg"></i> VOT</a></div>
|
||||
<div class="card p-3 table-responsive"><table class="table align-middle"><thead><tr><th>Kod</th><th>Nama</th><th>Jabatan</th><th>Status</th><th></th></tr></thead><tbody>@foreach($vot as $v)<tr><td>{{ $v->kod }}</td><td>{{ $v->nama }}</td><td>{{ $v->jabatan?->nama }}</td><td><span class="badge text-bg-{{ $v->status ? 'success':'secondary' }}">{{ $v->status ? 'Aktif':'Tidak Aktif' }}</span></td><td class="text-end"><a class="btn btn-sm btn-outline-primary" href="{{ route('vot.edit',$v) }}"><i class="bi bi-pencil"></i></a><form class="d-inline" data-confirm method="POST" action="{{ route('vot.destroy',$v) }}">@csrf @method('DELETE')<button class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i></button></form></td></tr>@endforeach</tbody></table>{{ $vot->links() }}</div>
|
||||
@endsection
|
||||
12
resources/views/auth/change-password.blade.php
Normal file
12
resources/views/auth/change-password.blade.php
Normal file
@@ -0,0 +1,12 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Tukar Kata Laluan')
|
||||
@section('content')
|
||||
<div class="card p-4 col-lg-6">
|
||||
<form method="POST" action="{{ route('password.update') }}">@csrf @method('PUT')
|
||||
<div class="mb-3"><label class="form-label">Kata Laluan Semasa</label><input type="password" name="current_password" class="form-control" required></div>
|
||||
<div class="mb-3"><label class="form-label">Kata Laluan Baru</label><input type="password" name="password" class="form-control" required></div>
|
||||
<div class="mb-3"><label class="form-label">Sahkan Kata Laluan</label><input type="password" name="password_confirmation" class="form-control" required></div>
|
||||
<button class="btn btn-primary">Kemaskini</button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
5
resources/views/auth/forgot-password.blade.php
Normal file
5
resources/views/auth/forgot-password.blade.php
Normal file
@@ -0,0 +1,5 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Forgot Password')
|
||||
@section('content')
|
||||
<div class="row justify-content-center"><div class="col-md-5"><div class="card p-4"><h1 class="h5 mb-3">Reset Password</h1><form method="POST" action="{{ route('password.email') }}">@csrf<div class="mb-3"><label class="form-label">Email</label><input name="email" type="email" class="form-control" required autofocus></div><button class="btn btn-primary w-100">Hantar Pautan Reset</button><a href="{{ route('login') }}" class="btn btn-link w-100 mt-2">Kembali ke login</a></form></div></div></div>
|
||||
@endsection
|
||||
25
resources/views/auth/login.blade.php
Normal file
25
resources/views/auth/login.blade.php
Normal file
@@ -0,0 +1,25 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Log Masuk')
|
||||
@section('content')
|
||||
<div class="row justify-content-center align-items-center" style="min-height:78vh">
|
||||
<div class="col-md-5 col-lg-4">
|
||||
<div class="card p-4">
|
||||
<div class="text-center mb-4">
|
||||
<div class="stat-icon mx-auto mb-3"><i class="bi bi-bank2 fs-4"></i></div>
|
||||
<h1 class="h4 mb-1">MyBajet MBIP</h1>
|
||||
<p class="text-muted mb-0">Sistem Pengurusan Bajet</p>
|
||||
</div>
|
||||
<form method="POST" action="{{ route('login') }}">
|
||||
@csrf
|
||||
<div class="mb-3"><label class="form-label">Email</label><input name="email" type="email" value="{{ old('email') }}" class="form-control" required autofocus></div>
|
||||
<div class="mb-3"><label class="form-label">Kata Laluan</label><input name="password" type="password" class="form-control" required></div>
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<label class="form-check"><input class="form-check-input" type="checkbox" name="remember"> <span class="form-check-label">Ingat saya</span></label>
|
||||
<a class="small" href="{{ route('password.request') }}">Lupa kata laluan?</a>
|
||||
</div>
|
||||
<button class="btn btn-primary w-100">Log Masuk</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
5
resources/views/auth/reset-password.blade.php
Normal file
5
resources/views/auth/reset-password.blade.php
Normal file
@@ -0,0 +1,5 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Reset Password')
|
||||
@section('content')
|
||||
<div class="row justify-content-center"><div class="col-md-5"><div class="card p-4"><h1 class="h5 mb-3">Tetapkan Kata Laluan Baru</h1><form method="POST" action="{{ route('password.store') }}">@csrf<input type="hidden" name="token" value="{{ $token }}"><div class="mb-3"><label class="form-label">Email</label><input name="email" type="email" class="form-control" value="{{ old('email',$email) }}" required></div><div class="mb-3"><label class="form-label">Kata Laluan</label><input name="password" type="password" class="form-control" required></div><div class="mb-3"><label class="form-label">Sahkan Kata Laluan</label><input name="password_confirmation" type="password" class="form-control" required></div><button class="btn btn-primary w-100">Reset Password</button></form></div></div></div>
|
||||
@endsection
|
||||
35
resources/views/dashboard/index.blade.php
Normal file
35
resources/views/dashboard/index.blade.php
Normal file
@@ -0,0 +1,35 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Dashboard')
|
||||
@section('content')
|
||||
<div class="row g-3 mb-4">
|
||||
@foreach([
|
||||
['Jumlah Permohonan',$total,'bi-folder2-open'],
|
||||
['Bajet Diluluskan','RM '.number_format($approved,2),'bi-cash-coin'],
|
||||
['Permohonan Ditolak',$rejected,'bi-x-octagon'],
|
||||
['Menunggu Tindakan',$pending,'bi-hourglass-split'],
|
||||
] as $card)
|
||||
<div class="col-md-6 col-xl-3"><div class="card p-3"><div class="d-flex justify-content-between align-items-center"><div><div class="text-muted small">{{ $card[0] }}</div><div class="h4 mb-0">{{ $card[1] }}</div></div><div class="stat-icon"><i class="bi {{ $card[2] }}"></i></div></div></div></div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="row g-3">
|
||||
<div class="col-lg-7">
|
||||
<div class="card p-3">
|
||||
<div class="fw-semibold mb-3">Recent Submission</div>
|
||||
<div class="table-responsive"><table class="table align-middle">
|
||||
<thead><tr><th>No Rujukan</th><th>Jabatan</th><th>Status</th><th class="text-end">Jumlah</th></tr></thead>
|
||||
<tbody>@forelse($recent as $p)<tr><td>{{ $p->no_rujukan }}</td><td>{{ $p->jabatan?->nama }}</td><td><span class="badge text-bg-primary">{{ $p->status }}</span></td><td class="text-end">RM {{ number_format($p->jumlah_keseluruhan,2) }}</td></tr>@empty<tr><td colspan="4" class="text-muted">Tiada rekod.</td></tr>@endforelse</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5">
|
||||
<div class="card p-3 mb-3">
|
||||
<div class="fw-semibold mb-3">Statistik Jabatan</div>
|
||||
@foreach($byJabatan as $j)<div class="d-flex justify-content-between border-bottom py-2"><span>{{ $j->nama }}</span><span class="badge text-bg-light">{{ $j->users_count }} user</span></div>@endforeach
|
||||
</div>
|
||||
<div class="card p-3">
|
||||
<div class="fw-semibold mb-3">Recent Activities</div>
|
||||
@forelse($activities as $a)<div class="small border-bottom py-2"><span class="text-muted">{{ $a->created_at->format('d/m/Y H:i') }}</span> {{ $a->description }}</div>@empty<div class="text-muted small">Tiada aktiviti.</div>@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
92
resources/views/layouts/app.blade.php
Normal file
92
resources/views/layouts/app.blade.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<!doctype html>
|
||||
<html lang="ms">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<title>@yield('title', 'MyBajet MBIP')</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<link href="https://cdn.datatables.net/2.3.0/css/dataTables.bootstrap5.min.css" rel="stylesheet">
|
||||
<style>
|
||||
:root { --mbip-blue:#0b4ea2; --mbip-navy:#063b78; --mbip-soft:#f4f7fb; }
|
||||
body { background: var(--mbip-soft); color:#1f2937; font-size: .94rem; }
|
||||
.app-shell { min-height: 100vh; display:flex; }
|
||||
.sidebar { width: 268px; background: linear-gradient(180deg,var(--mbip-navy),#0b4ea2); color:#fff; position: sticky; top:0; height:100vh; }
|
||||
.sidebar a { color:#dbeafe; text-decoration:none; border-radius:8px; padding:.68rem .8rem; display:flex; gap:.65rem; align-items:center; }
|
||||
.sidebar a:hover,.sidebar a.active { background: rgba(255,255,255,.14); color:#fff; }
|
||||
.content { flex:1; min-width:0; }
|
||||
.topbar { background:#fff; border-bottom:1px solid #e5e7eb; }
|
||||
.card, .table-wrap { border:1px solid #e5e7eb; border-radius:8px; box-shadow:0 8px 24px rgba(15,23,42,.05); }
|
||||
.stat-icon { width:42px; height:42px; display:grid; place-items:center; border-radius:8px; background:#e8f1ff; color:var(--mbip-blue); }
|
||||
.btn-primary { background:var(--mbip-blue); border-color:var(--mbip-blue); }
|
||||
.form-control,.form-select,.btn { border-radius:7px; }
|
||||
@media (max-width: 991.98px) { .app-shell{display:block}.sidebar{width:100%;height:auto;position:relative}.sidebar nav{display:grid;grid-template-columns:repeat(2,1fr);gap:.25rem} }
|
||||
</style>
|
||||
@stack('styles')
|
||||
</head>
|
||||
<body>
|
||||
<div class="app-shell">
|
||||
@auth
|
||||
<aside class="sidebar p-3">
|
||||
<div class="d-flex align-items-center gap-2 mb-4">
|
||||
<div class="stat-icon bg-white text-primary"><i class="bi bi-bank2"></i></div>
|
||||
<div>
|
||||
<div class="fw-bold">MyBajet MBIP</div>
|
||||
<small class="text-white-50">Sistem Pengurusan Bajet</small>
|
||||
</div>
|
||||
</div>
|
||||
<nav class="d-grid gap-1">
|
||||
<a href="{{ route('dashboard') }}" class="{{ request()->routeIs('dashboard') ? 'active' : '' }}"><i class="bi bi-speedometer2"></i> Dashboard</a>
|
||||
@role('Pemohon|Admin')
|
||||
<a href="{{ route('permohonan.index') }}" class="{{ request()->routeIs('permohonan.*') ? 'active' : '' }}"><i class="bi bi-file-earmark-plus"></i> Permohonan</a>
|
||||
@endrole
|
||||
@role('Pelaksana|Admin')
|
||||
<a href="{{ route('semakan.index') }}" class="{{ request()->routeIs('semakan.*') ? 'active' : '' }}"><i class="bi bi-clipboard-check"></i> Semakan</a>
|
||||
@endrole
|
||||
@role('Admin')
|
||||
<a href="{{ route('approvals.index') }}"><i class="bi bi-patch-check"></i> Kelulusan</a>
|
||||
<a href="{{ route('jabatan.index') }}"><i class="bi bi-diagram-3"></i> Jabatan</a>
|
||||
<a href="{{ route('vot.index') }}"><i class="bi bi-journal-code"></i> VOT</a>
|
||||
<a href="{{ route('users.index') }}"><i class="bi bi-people"></i> User</a>
|
||||
<a href="{{ route('roles.index') }}"><i class="bi bi-shield-lock"></i> Role</a>
|
||||
<a href="{{ route('reports.index') }}"><i class="bi bi-bar-chart-line"></i> Laporan</a>
|
||||
@endrole
|
||||
</nav>
|
||||
</aside>
|
||||
@endauth
|
||||
<main class="content">
|
||||
@auth
|
||||
<div class="topbar px-4 py-3 d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<div class="fw-semibold">@yield('title', 'Dashboard')</div>
|
||||
<small class="text-muted">{{ auth()->user()->jabatan?->nama ?? 'Majlis Bandaraya Iskandar Puteri' }}</small>
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<a class="btn btn-light btn-sm" href="{{ route('profile.edit') }}"><i class="bi bi-person-circle"></i> {{ auth()->user()->name }}</a>
|
||||
<form method="POST" action="{{ route('logout') }}">@csrf <button class="btn btn-outline-danger btn-sm"><i class="bi bi-box-arrow-right"></i></button></form>
|
||||
</div>
|
||||
</div>
|
||||
@endauth
|
||||
<div class="@auth p-4 @else container py-5 @endauth">
|
||||
@if(session('success')) <div class="alert alert-success">{{ session('success') }}</div> @endif
|
||||
@if($errors->any()) <div class="alert alert-danger">{{ $errors->first() }}</div> @endif
|
||||
@yield('content')
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/2.3.0/js/dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/2.3.0/js/dataTables.bootstrap5.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script>
|
||||
document.querySelectorAll('[data-confirm]').forEach(form => form.addEventListener('submit', e => {
|
||||
e.preventDefault();
|
||||
Swal.fire({title:'Sahkan tindakan?', icon:'question', showCancelButton:true, confirmButtonText:'Ya', cancelButtonText:'Batal'}).then(r => { if (r.isConfirmed) form.submit(); });
|
||||
}));
|
||||
document.querySelectorAll('table[data-datatable]').forEach(table => new DataTable(table, {paging:false, searching:false, info:false}));
|
||||
</script>
|
||||
@stack('scripts')
|
||||
</body>
|
||||
</html>
|
||||
5
resources/views/pelaksana/index.blade.php
Normal file
5
resources/views/pelaksana/index.blade.php
Normal file
@@ -0,0 +1,5 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Senarai Tugasan Semakan')
|
||||
@section('content')
|
||||
<div class="card p-3 table-responsive"><table class="table align-middle"><thead><tr><th>No Rujukan</th><th>Pemohon</th><th>VOT</th><th>Status</th><th class="text-end">Jumlah</th><th></th></tr></thead><tbody>@foreach($permohonan as $p)<tr><td>{{ $p->no_rujukan }}</td><td>{{ $p->user?->name }}</td><td>{{ $p->vot?->kod }}</td><td><span class="badge text-bg-info">{{ $p->status }}</span></td><td class="text-end">RM {{ number_format($p->jumlah_keseluruhan,2) }}</td><td class="text-end"><a href="{{ route('semakan.show',$p) }}" class="btn btn-sm btn-primary">Semak</a></td></tr>@endforeach</tbody></table>{{ $permohonan->links() }}</div>
|
||||
@endsection
|
||||
9
resources/views/pelaksana/show.blade.php
Normal file
9
resources/views/pelaksana/show.blade.php
Normal file
@@ -0,0 +1,9 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Semak Permohonan')
|
||||
@section('content')
|
||||
<form method="POST" action="{{ route('semakan.update',$permohonan) }}" class="card p-4">@csrf @method('PUT')
|
||||
<div class="mb-3"><div class="fw-semibold">{{ $permohonan->no_rujukan }}</div><div class="text-muted">{{ $permohonan->user?->name }} | {{ $permohonan->jabatan?->nama }}</div></div>
|
||||
<div class="table-responsive"><table class="table align-middle"><thead><tr><th>Item</th><th>Jumlah</th><th>Status Item</th><th>Catatan</th></tr></thead><tbody>@foreach($permohonan->items as $item)<tr><td>{{ $item->item }}<div class="small text-muted">{{ $item->kuantiti }} x RM {{ number_format($item->harga_anggaran,2) }}</div></td><td>RM {{ number_format($item->jumlah,2) }}</td><td><select name="items[{{ $item->id }}][status_item]" class="form-select">@foreach(['Pending','Accepted','Rejected','Partial Accept'] as $s)<option @selected($item->status_item===$s)>{{ $s }}</option>@endforeach</select></td><td><input name="items[{{ $item->id }}][catatan_pelaksana]" class="form-control" value="{{ $item->catatan_pelaksana }}"></td></tr>@endforeach</tbody></table></div>
|
||||
<div class="mb-3"><label class="form-label">Catatan Semakan</label><textarea name="catatan_semakan" class="form-control">{{ $permohonan->catatan_semakan }}</textarea></div><button class="btn btn-primary">Submit kepada Admin</button>
|
||||
</form>
|
||||
@endsection
|
||||
13
resources/views/permohonan/form.blade.php
Normal file
13
resources/views/permohonan/form.blade.php
Normal file
@@ -0,0 +1,13 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Create Permohonan')
|
||||
@section('content')
|
||||
<form method="POST" action="{{ route('permohonan.store') }}" enctype="multipart/form-data" class="card p-4">@csrf
|
||||
<div class="row g-3"><div class="col-md-6"><label class="form-label">VOT</label><select name="vot_id" class="form-select" required><option value="">Pilih VOT</option>@foreach($vot as $v)<option value="{{ $v->id }}">{{ $v->kod }} - {{ $v->nama }} ({{ $v->jabatan?->nama }})</option>@endforeach</select></div><div class="col-md-6"><label class="form-label">Kategori</label><input name="kategori" class="form-control" required></div><div class="col-12"><label class="form-label">Tujuan</label><textarea name="tujuan" class="form-control" rows="3" required></textarea></div><div class="col-md-6"><label class="form-label">Gambar 1</label><input type="file" name="gambar_1" class="form-control image-input" accept="image/png,image/jpeg"></div><div class="col-md-6"><label class="form-label">Gambar 2</label><input type="file" name="gambar_2" class="form-control image-input" accept="image/png,image/jpeg"></div></div>
|
||||
<hr><div class="d-flex justify-content-between align-items-center mb-2"><h2 class="h6 mb-0">Maklumat Item</h2><button type="button" class="btn btn-sm btn-outline-primary" id="addItem"><i class="bi bi-plus"></i> Item</button></div>
|
||||
<div class="table-responsive"><table class="table" id="itemsTable"><thead><tr><th>Item</th><th style="width:130px">Kuantiti</th><th style="width:180px">Harga Anggaran</th><th></th></tr></thead><tbody><tr><td><input name="items[0][item]" class="form-control" required></td><td><input name="items[0][kuantiti]" type="number" min="1" class="form-control" required></td><td><input name="items[0][harga_anggaran]" type="number" min="0" step="0.01" class="form-control" required></td><td><button type="button" class="btn btn-outline-danger remove-item"><i class="bi bi-trash"></i></button></td></tr></tbody></table></div>
|
||||
<div class="d-flex gap-2"><button name="action" value="draft" class="btn btn-outline-secondary">Simpan Draft</button><button name="action" value="submit" class="btn btn-primary">Hantar kepada Pelaksana</button></div>
|
||||
</form>
|
||||
@push('scripts')<script>
|
||||
let i=1;document.getElementById('addItem').onclick=()=>{document.querySelector('#itemsTable tbody').insertAdjacentHTML('beforeend',`<tr><td><input name="items[${i}][item]" class="form-control" required></td><td><input name="items[${i}][kuantiti]" type="number" min="1" class="form-control" required></td><td><input name="items[${i}][harga_anggaran]" type="number" min="0" step="0.01" class="form-control" required></td><td><button type="button" class="btn btn-outline-danger remove-item"><i class="bi bi-trash"></i></button></td></tr>`);i++};document.addEventListener('click',e=>{if(e.target.closest('.remove-item')&&document.querySelectorAll('#itemsTable tbody tr').length>1)e.target.closest('tr').remove()});
|
||||
</script>@endpush
|
||||
@endsection
|
||||
6
resources/views/permohonan/index.blade.php
Normal file
6
resources/views/permohonan/index.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Permohonan Bajet')
|
||||
@section('content')
|
||||
<div class="d-flex justify-content-end mb-3"><a href="{{ route('permohonan.create') }}" class="btn btn-primary"><i class="bi bi-plus-lg"></i> Permohonan</a></div>
|
||||
<div class="card p-3 table-responsive"><table class="table align-middle"><thead><tr><th>No Rujukan</th><th>VOT</th><th>Kategori</th><th>Status</th><th class="text-end">Jumlah</th><th></th></tr></thead><tbody>@foreach($permohonan as $p)<tr><td>{{ $p->no_rujukan }}</td><td>{{ $p->vot?->kod }}</td><td>{{ $p->kategori }}</td><td><span class="badge text-bg-primary">{{ $p->status }}</span></td><td class="text-end">RM {{ number_format($p->jumlah_keseluruhan,2) }}</td><td class="text-end"><a class="btn btn-sm btn-outline-primary" href="{{ route('permohonan.show',$p) }}"><i class="bi bi-eye"></i></a>@if($p->status==='Draft')<form class="d-inline" method="POST" action="{{ route('permohonan.submit',$p) }}">@csrf<button class="btn btn-sm btn-primary">Hantar</button></form>@endif</td></tr>@endforeach</tbody></table>{{ $permohonan->links() }}</div>
|
||||
@endsection
|
||||
6
resources/views/permohonan/show.blade.php
Normal file
6
resources/views/permohonan/show.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Butiran Permohonan')
|
||||
@section('content')
|
||||
<div class="card p-4 mb-3"><div class="row g-3"><div class="col-md-4"><div class="text-muted small">No Rujukan</div><div class="fw-semibold">{{ $permohonan->no_rujukan }}</div></div><div class="col-md-4"><div class="text-muted small">Status</div><span class="badge text-bg-primary">{{ $permohonan->status }}</span></div><div class="col-md-4"><div class="text-muted small">Jumlah</div><div class="fw-semibold">RM {{ number_format($permohonan->jumlah_keseluruhan,2) }}</div></div><div class="col-md-6"><div class="text-muted small">Jabatan</div>{{ $permohonan->jabatan?->nama }}</div><div class="col-md-6"><div class="text-muted small">VOT</div>{{ $permohonan->vot?->kod }} - {{ $permohonan->vot?->nama }}</div><div class="col-12"><div class="text-muted small">Tujuan</div>{{ $permohonan->tujuan }}</div></div></div>
|
||||
<div class="card p-3 table-responsive"><table class="table"><thead><tr><th>Item</th><th>Kuantiti</th><th>Harga</th><th>Jumlah</th><th>Status</th><th>Catatan</th></tr></thead><tbody>@foreach($permohonan->items as $item)<tr><td>{{ $item->item }}</td><td>{{ $item->kuantiti }}</td><td>RM {{ number_format($item->harga_anggaran,2) }}</td><td>RM {{ number_format($item->jumlah,2) }}</td><td>{{ $item->status_item }}</td><td>{{ $item->catatan_pelaksana }}</td></tr>@endforeach</tbody></table></div>
|
||||
@endsection
|
||||
15
resources/views/profile/edit.blade.php
Normal file
15
resources/views/profile/edit.blade.php
Normal file
@@ -0,0 +1,15 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Profil')
|
||||
@section('content')
|
||||
<div class="card p-4 col-lg-7">
|
||||
<form method="POST" action="{{ route('profile.update') }}">@csrf @method('PUT')
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6"><label class="form-label">Nama</label><input name="name" class="form-control" value="{{ old('name', auth()->user()->name) }}" required></div>
|
||||
<div class="col-md-6"><label class="form-label">Email</label><input class="form-control" value="{{ auth()->user()->email }}" disabled></div>
|
||||
<div class="col-md-6"><label class="form-label">No Telefon</label><input name="no_telefon" class="form-control" value="{{ old('no_telefon', auth()->user()->no_telefon) }}"></div>
|
||||
<div class="col-md-6"><label class="form-label">Jawatan</label><input name="jawatan" class="form-control" value="{{ old('jawatan', auth()->user()->jawatan) }}"></div>
|
||||
</div>
|
||||
<div class="mt-4 d-flex gap-2"><button class="btn btn-primary">Simpan</button><a href="{{ route('password.edit') }}" class="btn btn-outline-secondary">Tukar Kata Laluan</a></div>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
1
resources/views/reports/_table.blade.php
Normal file
1
resources/views/reports/_table.blade.php
Normal file
@@ -0,0 +1 @@
|
||||
<div class="card p-3 table-responsive"><table class="table align-middle"><thead><tr><th>No Rujukan</th><th>Pemohon</th><th>Jabatan</th><th>VOT</th><th>Status</th><th class="text-end">Jumlah</th><th></th></tr></thead><tbody>@foreach($permohonan as $p)<tr><td>{{ $p->no_rujukan }}</td><td>{{ $p->user?->name }}</td><td>{{ $p->jabatan?->nama }}</td><td>{{ $p->vot?->kod }}</td><td><span class="badge text-bg-primary">{{ $p->status }}</span></td><td class="text-end">RM {{ number_format($p->jumlah_keseluruhan,2) }}</td><td class="text-end">@isset($approval)<form class="d-inline" method="POST" action="{{ route('approvals.approve',$p) }}">@csrf<button class="btn btn-sm btn-success">Approve</button></form><form class="d-inline" method="POST" action="{{ route('approvals.reopen',$p) }}">@csrf<button class="btn btn-sm btn-outline-secondary">Reopen</button></form>@endisset</td></tr>@endforeach</tbody></table>{{ $permohonan->links() }}</div>
|
||||
6
resources/views/reports/index.blade.php
Normal file
6
resources/views/reports/index.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Report & Analytics')
|
||||
@section('content')
|
||||
<div class="d-flex gap-2 justify-content-end mb-3"><a class="btn btn-outline-success" href="{{ route('reports.excel') }}"><i class="bi bi-file-earmark-excel"></i> Excel</a><a class="btn btn-outline-danger" href="{{ route('reports.pdf') }}"><i class="bi bi-file-earmark-pdf"></i> PDF</a></div>
|
||||
@include('reports._table')
|
||||
@endsection
|
||||
1
resources/views/reports/pdf.blade.php
Normal file
1
resources/views/reports/pdf.blade.php
Normal file
@@ -0,0 +1 @@
|
||||
<!doctype html><html><head><meta charset="utf-8"><style>body{font-family:DejaVu Sans,sans-serif;font-size:12px}table{width:100%;border-collapse:collapse}td,th{border:1px solid #bbb;padding:6px;text-align:left}h1{font-size:18px}</style></head><body><h1>Laporan Permohonan Bajet Tahunan MBIP</h1><table><thead><tr><th>No Rujukan</th><th>Pemohon</th><th>Jabatan</th><th>VOT</th><th>Status</th><th>Jumlah</th></tr></thead><tbody>@foreach($permohonan as $p)<tr><td>{{ $p->no_rujukan }}</td><td>{{ $p->user?->name }}</td><td>{{ $p->jabatan?->nama }}</td><td>{{ $p->vot?->kod }}</td><td>{{ $p->status }}</td><td>RM {{ number_format($p->jumlah_keseluruhan,2) }}</td></tr>@endforeach</tbody></table></body></html>
|
||||
5
resources/views/reports/permohonan.blade.php
Normal file
5
resources/views/reports/permohonan.blade.php
Normal file
@@ -0,0 +1,5 @@
|
||||
@extends('layouts.app')
|
||||
@section('title','Kelulusan Admin')
|
||||
@section('content')
|
||||
@include('reports._table', ['approval' => true])
|
||||
@endsection
|
||||
277
resources/views/welcome.blade.php
Normal file
277
resources/views/welcome.blade.php
Normal file
File diff suppressed because one or more lines are too long
8
routes/console.php
Normal file
8
routes/console.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
63
routes/web.php
Normal file
63
routes/web.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Admin\ApprovalController;
|
||||
use App\Http\Controllers\Admin\JabatanController;
|
||||
use App\Http\Controllers\Admin\ReportController;
|
||||
use App\Http\Controllers\Admin\RoleController;
|
||||
use App\Http\Controllers\Admin\UserController;
|
||||
use App\Http\Controllers\Admin\VotController;
|
||||
use App\Http\Controllers\Auth\LoginController;
|
||||
use App\Http\Controllers\Auth\PasswordController;
|
||||
use App\Http\Controllers\Auth\ForgotPasswordController;
|
||||
use App\Http\Controllers\Auth\ResetPasswordController;
|
||||
use App\Http\Controllers\DashboardController;
|
||||
use App\Http\Controllers\Pelaksana\SemakanController;
|
||||
use App\Http\Controllers\Pemohon\PermohonanController;
|
||||
use App\Http\Controllers\ProfileController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/', function () {
|
||||
return redirect()->route('dashboard');
|
||||
});
|
||||
|
||||
Route::middleware('guest')->group(function () {
|
||||
Route::get('login', [LoginController::class, 'create'])->name('login');
|
||||
Route::post('login', [LoginController::class, 'store']);
|
||||
Route::get('forgot-password', [ForgotPasswordController::class, 'create'])->name('password.request');
|
||||
Route::post('forgot-password', [ForgotPasswordController::class, 'store'])->name('password.email');
|
||||
Route::get('reset-password/{token}', [ResetPasswordController::class, 'create'])->name('password.reset');
|
||||
Route::post('reset-password', [ResetPasswordController::class, 'store'])->name('password.store');
|
||||
});
|
||||
|
||||
Route::post('logout', [LoginController::class, 'destroy'])->middleware('auth')->name('logout');
|
||||
|
||||
Route::middleware(['auth', 'active'])->group(function () {
|
||||
Route::get('/dashboard', DashboardController::class)->name('dashboard');
|
||||
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
|
||||
Route::put('/profile', [ProfileController::class, 'update'])->name('profile.update');
|
||||
Route::get('/change-password', [PasswordController::class, 'edit'])->name('password.edit');
|
||||
Route::put('/change-password', [PasswordController::class, 'update'])->name('password.update');
|
||||
|
||||
Route::resource('permohonan', PermohonanController::class)->only(['index', 'create', 'store', 'show'])->middleware('role:Pemohon|Admin');
|
||||
Route::post('permohonan/{permohonan}/submit', [PermohonanController::class, 'submit'])->name('permohonan.submit')->middleware('role:Pemohon|Admin');
|
||||
|
||||
Route::middleware('role:Pelaksana|Admin')->group(function () {
|
||||
Route::get('semakan', [SemakanController::class, 'index'])->name('semakan.index');
|
||||
Route::get('semakan/{permohonan}', [SemakanController::class, 'show'])->name('semakan.show');
|
||||
Route::put('semakan/{permohonan}', [SemakanController::class, 'update'])->name('semakan.update');
|
||||
});
|
||||
|
||||
Route::middleware('role:Admin')->group(function () {
|
||||
Route::resource('jabatan', JabatanController::class)->except('show');
|
||||
Route::resource('vot', VotController::class)->except('show');
|
||||
Route::resource('users', UserController::class)->except('show');
|
||||
Route::post('users/{user}/reset-password', [UserController::class, 'resetPassword'])->name('users.reset-password');
|
||||
Route::resource('roles', RoleController::class)->except('show');
|
||||
Route::get('approvals', [ApprovalController::class, 'index'])->name('approvals.index');
|
||||
Route::post('approvals/{permohonan}/approve', [ApprovalController::class, 'approve'])->name('approvals.approve');
|
||||
Route::post('approvals/{permohonan}/reopen', [ApprovalController::class, 'reopen'])->name('approvals.reopen');
|
||||
Route::get('reports', [ReportController::class, 'index'])->name('reports.index');
|
||||
Route::get('reports/excel', [ReportController::class, 'excel'])->name('reports.excel');
|
||||
Route::get('reports/pdf', [ReportController::class, 'pdf'])->name('reports.pdf');
|
||||
});
|
||||
});
|
||||
4
storage/app/.gitignore
vendored
Normal file
4
storage/app/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*
|
||||
!private/
|
||||
!public/
|
||||
!.gitignore
|
||||
2
storage/app/private/.gitignore
vendored
Normal file
2
storage/app/private/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
2
storage/app/public/.gitignore
vendored
Normal file
2
storage/app/public/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user