Initial commit SIMRS
This commit is contained in:
commit
9a26efab48
18
backend/.editorconfig
Normal file
18
backend/.editorconfig
Normal file
@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
||||
10
backend/.gitattributes
vendored
Normal file
10
backend/.gitattributes
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
* text=auto
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
15
backend/.gitignore
vendored
Normal file
15
backend/.gitignore
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.phpunit.result.cache
|
||||
docker-compose.override.yml
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.idea
|
||||
/.vscode
|
||||
14
backend/.styleci.yml
Normal file
14
backend/.styleci.yml
Normal file
@ -0,0 +1,14 @@
|
||||
php:
|
||||
preset: laravel
|
||||
version: 8
|
||||
disabled:
|
||||
- no_unused_imports
|
||||
finder:
|
||||
not-name:
|
||||
- index.php
|
||||
- server.php
|
||||
js:
|
||||
finder:
|
||||
not-name:
|
||||
- webpack.mix.js
|
||||
css: true
|
||||
64
backend/README.md
Normal file
64
backend/README.md
Normal file
@ -0,0 +1,64 @@
|
||||
<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"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.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.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Cubet Techno Labs](https://cubettech.com)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[Many](https://www.many.co.uk)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
|
||||
- **[OP.GG](https://op.gg)**
|
||||
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
|
||||
- **[Lendio](https://lendio.com)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
32
backend/app/Console/Kernel.php
Normal file
32
backend/app/Console/Kernel.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
41
backend/app/Exceptions/Handler.php
Normal file
41
backend/app/Exceptions/Handler.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array<int, class-string<Throwable>>
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
115
backend/app/Http/Controllers/AsuransiController.php
Normal file
115
backend/app/Http/Controllers/AsuransiController.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Ms_Asuransi;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AsuransiController extends Controller
|
||||
{
|
||||
public function getAsuransi()
|
||||
{
|
||||
try {
|
||||
$data = Ms_Asuransi::where('statusenabled', true)->get();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Data asuransi berhasil diambil',
|
||||
'data' => $data
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat mengambil data asuransi',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahAsuransi(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'NamaAsuransi' => 'required|string|max:100',
|
||||
]);
|
||||
|
||||
$asuransi = Ms_Asuransi::create([
|
||||
'NamaAsuransi' => $validated['NamaAsuransi'],
|
||||
'statusenabled' => true,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Asuransi berhasil ditambahkan',
|
||||
'data' => $asuransi
|
||||
], 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat menambahkan asuransi',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateAsuransi(Request $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'NamaAsuransi' => 'required|string|max:100',
|
||||
]);
|
||||
|
||||
$asuransi = Ms_Asuransi::findOrFail($id);
|
||||
|
||||
$asuransi->update([
|
||||
'NamaAsuransi' => $validated['NamaAsuransi'],
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Asuransi berhasil diperbarui',
|
||||
'data' => $asuransi
|
||||
], 200);
|
||||
} catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Asuransi tidak ditemukan'
|
||||
], 404);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat memperbarui asuransi',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function hapusAsuransi($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$asuransi = Ms_Asuransi::findOrFail($id);
|
||||
$asuransi->statusenabled = false;
|
||||
$asuransi->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Asuransi berhasil dinonaktifkan',
|
||||
'data' => $asuransi
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat menghapus asuransi',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
100
backend/app/Http/Controllers/AuthController.php
Normal file
100
backend/app/Http/Controllers/AuthController.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
public function registerUser(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
// return $request->all();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'name' => 'required|string|max:100',
|
||||
'email' => 'required|email|unique:users,email',
|
||||
'id_pegawai' => 'required',
|
||||
'password' => 'required|string|min:6',
|
||||
]);
|
||||
|
||||
$user = User::create([
|
||||
'name' => $validated['name'],
|
||||
'email' => $validated['email'],
|
||||
'id_pegawai' => $validated['id_pegawai'],
|
||||
'password' => Hash::make($validated['password']),
|
||||
]);
|
||||
|
||||
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'User berhasil didaftarkan',
|
||||
'user' => $user,
|
||||
'token_type' => 'Bearer',
|
||||
], 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat registrasi',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function loginUser(Request $request)
|
||||
{
|
||||
// return $request->all();
|
||||
try {
|
||||
$credentials = $request->validate([
|
||||
'name' => 'required',
|
||||
'password' => 'required',
|
||||
]);
|
||||
if (!Auth::attempt($credentials)) {
|
||||
return response()->json([
|
||||
'message' => 'Username atau password salah',
|
||||
], 401);
|
||||
}
|
||||
$user = Auth::user();
|
||||
if ($user->statusenabled === false) {
|
||||
return response()->json([
|
||||
'message' => 'Akun dinonaktifkan'
|
||||
], 403);
|
||||
}
|
||||
$token = $user->createToken('auth_token')->plainTextToken;
|
||||
return response()->json([
|
||||
'message' => 'Login berhasil',
|
||||
'user' => $user,
|
||||
'access_token' => $token,
|
||||
'token_type' => 'Bearer',
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat login',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function logoutUser(Request $request)
|
||||
{
|
||||
try {
|
||||
$request->user()->currentAccessToken()->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Berhasil logout dan token dihapus',
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Gagal logout',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
backend/app/Http/Controllers/Controller.php
Normal file
13
backend/app/Http/Controllers/Controller.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
113
backend/app/Http/Controllers/DepartemenController.php
Normal file
113
backend/app/Http/Controllers/DepartemenController.php
Normal file
@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Ms_Departemen;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DepartemenController extends Controller
|
||||
{
|
||||
public function getDepartemen()
|
||||
{
|
||||
try {
|
||||
$data = Ms_Departemen::where('statusenabled', true)->get();
|
||||
return response()->json([
|
||||
'message' => 'Data departemen berhasil diambil',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Gagal ambil departemen',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahDepartemen(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'nama_departemen' => 'required|string|max:100',
|
||||
]);
|
||||
|
||||
$data = Ms_Departemen::create([
|
||||
'nama_departemen' => $validated['nama_departemen'],
|
||||
'statusenabled' => true
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Departemen berhasil ditambahkan',
|
||||
'data' => $data
|
||||
], 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal tambah departemen',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateDepartemen(Request $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'nama_departemen' => 'required|string|max:100',
|
||||
]);
|
||||
|
||||
$departemen = Ms_Departemen::findOrFail($id);
|
||||
|
||||
$departemen->update([
|
||||
'nama_departemen' => $validated['nama_departemen'],
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Departemen berhasil diperbarui',
|
||||
'data' => $departemen
|
||||
], 200);
|
||||
} catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Departemen tidak ditemukan'
|
||||
], 404);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat update departemen',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function hapusDepartemen($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$departemen = Ms_Departemen::findOrFail($id);
|
||||
$departemen->statusenabled = false;
|
||||
$departemen->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Departemen berhasil dinonaktifkan',
|
||||
'data' => $departemen
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal hapus departemen',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
91
backend/app/Http/Controllers/JenisPegawaiController.php
Normal file
91
backend/app/Http/Controllers/JenisPegawaiController.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Ms_JenisPegawai;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class JenisPegawaiController extends Controller
|
||||
{
|
||||
public function getJenisPegawai()
|
||||
{
|
||||
$data = Ms_JenisPegawai::where('statusenabled', true)->get();
|
||||
return response()->json([
|
||||
'message' => 'Data jenis pegawai berhasil diambil',
|
||||
'data' => $data
|
||||
]);
|
||||
}
|
||||
|
||||
public function getDetailJenisPegawai($id)
|
||||
{
|
||||
$jenis = Ms_JenisPegawai::where('statusenabled', true)->find($id);
|
||||
|
||||
if (!$jenis) {
|
||||
return response()->json([
|
||||
'message' => 'Jenis pegawai tidak ditemukan'
|
||||
], 404);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Data jenis pegawai ditemukan',
|
||||
'data' => $jenis
|
||||
]);
|
||||
}
|
||||
|
||||
public function tambahJenisPegawai(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'nama_jenis' => 'required|string|max:100',
|
||||
]);
|
||||
|
||||
$jenis = Ms_JenisPegawai::create([
|
||||
'nama_jenis' => $validated['nama_jenis'],
|
||||
'statusenabled' => true,
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Jenis pegawai berhasil ditambahkan',
|
||||
'data' => $jenis
|
||||
], 201);
|
||||
}
|
||||
|
||||
public function updateJenisPegawai(Request $request, $id)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'nama_jenis' => 'required|string|max:100',
|
||||
]);
|
||||
|
||||
$jenis = Ms_JenisPegawai::where('statusenabled', true)->find($id);
|
||||
|
||||
if (!$jenis) {
|
||||
return response()->json([
|
||||
'message' => 'Jenis pegawai tidak ditemukan'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$jenis->update($validated);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Jenis pegawai berhasil diperbarui',
|
||||
'data' => $jenis
|
||||
]);
|
||||
}
|
||||
|
||||
public function hapusJenisPegawai($id)
|
||||
{
|
||||
$jenis = Ms_JenisPegawai::where('statusenabled', true)->find($id);
|
||||
|
||||
if (!$jenis) {
|
||||
return response()->json([
|
||||
'message' => 'Jenis pegawai tidak ditemukan'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$jenis->update(['statusenabled' => false]);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Jenis pegawai berhasil dihapus (soft delete)'
|
||||
]);
|
||||
}
|
||||
}
|
||||
147
backend/app/Http/Controllers/KamarController.php
Normal file
147
backend/app/Http/Controllers/KamarController.php
Normal file
@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Ms_Kamar;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class KamarController extends Controller
|
||||
{
|
||||
public function getKamar()
|
||||
{
|
||||
try {
|
||||
$data = Ms_Kamar::with(['ruangan', 'kelas'])
|
||||
->where('statusenabled', true)
|
||||
->get();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Data kamar berhasil diambil',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Gagal ambil data kamar',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDetailKamar($id)
|
||||
{
|
||||
try {
|
||||
$kamar = Ms_Kamar::with(['ruangan', 'kelas'])
|
||||
->where('statusenabled', true)
|
||||
->findOrFail($id);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Data kamar ditemukan',
|
||||
'data' => $kamar
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Kamar tidak ditemukan',
|
||||
'error' => $e->getMessage()
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahKamar(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'nama_kamar' => 'required|string|max:100',
|
||||
'ruangan_id' => 'required|numeric',
|
||||
'kelas_id' => 'required|numeric',
|
||||
'jumlah_tempat_tidur' => 'required|integer|min:0',
|
||||
]);
|
||||
|
||||
// Get last room entry and increment the ID for the next room
|
||||
$lastKamar = Ms_Kamar::orderBy('id', 'desc')->first();
|
||||
$nextNumber = $lastKamar ? $lastKamar->id + 1 : 1;
|
||||
$kodeKamar = 'KMR-' . str_pad($nextNumber, 2, '0', STR_PAD_LEFT);
|
||||
|
||||
$kamar = Ms_Kamar::create([
|
||||
'nama_kamar' => $validated['nama_kamar'],
|
||||
'ruangan_id' => $validated['ruangan_id'],
|
||||
'kelas_id' => $validated['kelas_id'],
|
||||
'kode_kamar' => $kodeKamar, // Automatically generated kode kamar
|
||||
'jumlah_tempat_tidur' => $validated['jumlah_tempat_tidur'], // Ensure jumlah_tempat_tidur is passed
|
||||
'statusenabled' => true,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Kamar berhasil ditambahkan',
|
||||
'data' => $kamar
|
||||
], 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal tambah kamar',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function updateKamar(Request $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'nama_kamar' => 'required|string|max:100',
|
||||
'ruangan_id' => 'required|numeric',
|
||||
'kelas_id' => 'required|numeric',
|
||||
'jumlah_tempat_tidur' => 'required|integer|min:0',
|
||||
]);
|
||||
|
||||
$kamar = Ms_Kamar::findOrFail($id);
|
||||
|
||||
$kamar->update([
|
||||
'nama_kamar' => $validated['nama_kamar'],
|
||||
'ruangan_id' => $validated['ruangan_id'],
|
||||
'kelas_id' => $validated['kelas_id'],
|
||||
'jumlah_tempat_tidur' => $validated['jumlah_tempat_tidur'],
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Kamar berhasil diperbarui',
|
||||
'data' => $kamar
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal update kamar',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function hapusKamar($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$kamar = Ms_Kamar::findOrFail($id);
|
||||
$kamar->statusenabled = false;
|
||||
$kamar->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Kamar berhasil dinonaktifkan',
|
||||
'data' => $kamar
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal hapus kamar',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
108
backend/app/Http/Controllers/KelasController.php
Normal file
108
backend/app/Http/Controllers/KelasController.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Ms_Kelas;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class KelasController extends Controller
|
||||
{
|
||||
public function getKelas()
|
||||
{
|
||||
try {
|
||||
$data = Ms_Kelas::where('statusenabled', true)->get();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Data kelas berhasil diambil',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Gagal ambil data kelas',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahKelas(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'nama_kelas' => 'required|string|max:50',
|
||||
]);
|
||||
|
||||
$kelas = Ms_Kelas::create([
|
||||
'nama_kelas' => $validated['nama_kelas'],
|
||||
'statusenabled' => true,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Kelas berhasil ditambahkan',
|
||||
'data' => $kelas
|
||||
], 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal tambah kelas',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateKelas(Request $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'nama_kelas' => 'required|string|max:50',
|
||||
]);
|
||||
|
||||
$kelas = Ms_Kelas::findOrFail($id);
|
||||
|
||||
$kelas->update([
|
||||
'nama_kelas' => $validated['nama_kelas'],
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Kelas berhasil diperbarui',
|
||||
'data' => $kelas
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal update kelas',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function hapusKelas($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$kelas = Ms_Kelas::findOrFail($id);
|
||||
$kelas->statusenabled = false;
|
||||
$kelas->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Kelas berhasil dinonaktifkan',
|
||||
'data' => $kelas
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal hapus kelas',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
66
backend/app/Http/Controllers/LaporanController.php
Normal file
66
backend/app/Http/Controllers/LaporanController.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LaporanController extends Controller
|
||||
{
|
||||
public function getLaporanPendaftaran(Request $request)
|
||||
{
|
||||
$query = DB::table('tr_registrasis')
|
||||
->join('ms__pasiens', 'tr_registrasis.MRPasien', '=', 'ms__pasiens.MRPasien')
|
||||
->join('ms__asuransis', 'tr_registrasis.IdAsuransi', '=', 'ms__asuransis.IdAsuransi')
|
||||
->join('ms__ruang_pelayanans', 'tr_registrasis.IdRuangPelayanan', '=', 'ms__ruang_pelayanans.IdRuangPelayanan')
|
||||
->join('ms__pegawais', 'tr_registrasis.IdPegawai', '=', 'ms__pegawais.IdPegawai')
|
||||
->select(
|
||||
'tr_registrasis.NoRegistrasi',
|
||||
'ms__pasiens.NamaPasien',
|
||||
'tr_registrasis.TanggalRegistrasi',
|
||||
'ms__asuransis.NamaAsuransi',
|
||||
'ms__ruang_pelayanans.NamaRuangPelayanan',
|
||||
'ms__pegawais.NamaPegawai',
|
||||
'tr_registrasis.JenisRawat'
|
||||
)
|
||||
->where('tr_registrasis.statusenabled', true);
|
||||
|
||||
if ($request->has('tanggal_start') && $request->has('tanggal_end')) {
|
||||
$query->whereBetween('tr_registrasis.TanggalRegistrasi', [$request->tanggal_start, $request->tanggal_end]);
|
||||
}
|
||||
|
||||
|
||||
$pasien = $query->get();
|
||||
|
||||
return response()->json([
|
||||
'data' => $pasien
|
||||
]);
|
||||
}
|
||||
|
||||
public function getPendapatanHarian(Request $request)
|
||||
{
|
||||
|
||||
$tanggal = $request->tanggal ?? date('Y-m-d');
|
||||
|
||||
$pendapatan = DB::table('tr__transaksis')
|
||||
->join('ms__tindakans', 'tr__transaksis.IdTindakan', '=', 'ms__tindakans.IdTindakan')
|
||||
->join('ms__pegawais', 'tr__transaksis.IdPegawai', '=', 'ms__pegawais.IdPegawai')
|
||||
->join('tr_registrasis', 'tr__transaksis.IdRegistrasi', '=', 'tr_registrasis.IdRegistrasi')
|
||||
->join('ms__pasiens', 'tr_registrasis.MRPasien', '=', 'ms__pasiens.MRPasien')
|
||||
->select(
|
||||
'tr__transaksis.created_at as TanggalTransaksi',
|
||||
'ms__pasiens.NoRM',
|
||||
'ms__pasiens.NamaPasien',
|
||||
'tr_registrasis.NoRegistrasi',
|
||||
'tr_registrasis.TanggalRegistrasi',
|
||||
DB::raw('SUM(ms__tindakans.TarifTindakan * tr__transaksis.JmlTindakan) as total_pendapatan')
|
||||
)
|
||||
->whereDate('tr__transaksis.created_at', $tanggal)
|
||||
->groupBy('tr__transaksis.created_at', 'ms__pasiens.NoRM', 'ms__pasiens.NamaPasien', 'tr_registrasis.NoRegistrasi', 'tr_registrasis.TanggalRegistrasi')
|
||||
->get();
|
||||
|
||||
return response()->json([
|
||||
'data' => $pendapatan
|
||||
]);
|
||||
}
|
||||
}
|
||||
152
backend/app/Http/Controllers/PasienController.php
Normal file
152
backend/app/Http/Controllers/PasienController.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Ms_Pasien;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PasienController extends Controller
|
||||
{
|
||||
// GET /pasien
|
||||
public function getPasien()
|
||||
{
|
||||
try {
|
||||
$data = Ms_Pasien::where('statusenabled', true)->get();
|
||||
return response()->json([
|
||||
'message' => 'Data pasien berhasil diambil',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Gagal ambil data pasien',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getDetailPasien($mr)
|
||||
{
|
||||
try {
|
||||
$pasien = Ms_Pasien::where('statusenabled', true)->findOrFail($mr);
|
||||
return response()->json([
|
||||
'message' => 'Data pasien ditemukan',
|
||||
'data' => $pasien
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Pasien tidak ditemukan',
|
||||
'error' => $e->getMessage()
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function tambahPasien(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'NamaPasien' => 'required|string|max:100',
|
||||
'TanggalLahir' => 'required|date',
|
||||
'JenisKelamin' => 'required|string|in:Laki-laki,Perempuan',
|
||||
'Alamat' => 'nullable|string|max:255',
|
||||
'NoHP' => 'nullable|string|max:20',
|
||||
]);
|
||||
|
||||
$last = Ms_Pasien::orderByDesc('NoRM')->first();
|
||||
$nextNumber = $last ? (int)$last->NoRM + 1 : 1;
|
||||
$noRM = str_pad($nextNumber, 5, '0', STR_PAD_LEFT);
|
||||
$mrPasien = 'RSABHK' . $nextNumber;
|
||||
|
||||
$pasien = Ms_Pasien::create([
|
||||
'MRPasien' => $mrPasien,
|
||||
'NoRM' => $noRM,
|
||||
'NamaPasien' => $validated['NamaPasien'],
|
||||
'TanggalLahir' => $validated['TanggalLahir'],
|
||||
'JenisKelamin' => $validated['JenisKelamin'],
|
||||
'Alamat' => $validated['Alamat'] ?? null,
|
||||
'NoHP' => $validated['NoHP'] ?? null,
|
||||
'statusenabled' => true,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Pasien berhasil ditambahkan',
|
||||
'data' => $pasien
|
||||
], 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal tambah pasien',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function updatePasien(Request $request, $mr)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'NamaPasien' => 'required|string|max:100',
|
||||
'TanggalLahir' => 'required|date',
|
||||
'JenisKelamin' => 'required|string|in:Laki-laki,Perempuan',
|
||||
'Alamat' => 'nullable|string|max:255',
|
||||
'NoHP' => 'nullable|string|max:20',
|
||||
]);
|
||||
|
||||
$pasien = Ms_Pasien::findOrFail($mr);
|
||||
|
||||
$pasien->update([
|
||||
'NamaPasien' => $validated['NamaPasien'],
|
||||
'TanggalLahir' => $validated['TanggalLahir'],
|
||||
'JenisKelamin' => $validated['JenisKelamin'],
|
||||
'Alamat' => $validated['Alamat'] ?? null,
|
||||
'NoHP' => $validated['NoHP'] ?? null,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Pasien berhasil diperbarui',
|
||||
'data' => $pasien
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal update pasien',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function hapusPasien($mr)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$pasien = Ms_Pasien::findOrFail($mr);
|
||||
$pasien->statusenabled = false;
|
||||
$pasien->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Pasien berhasil dinonaktifkan',
|
||||
'data' => $pasien
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal hapus pasien',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
146
backend/app/Http/Controllers/PegawaiController.php
Normal file
146
backend/app/Http/Controllers/PegawaiController.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Ms_Pegawai;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PegawaiController extends Controller
|
||||
{
|
||||
public function getPegawai()
|
||||
{
|
||||
try {
|
||||
$data = Ms_Pegawai::with('jenisPegawai') // ⬅️ Tambahin ini brooo
|
||||
->where('statusenabled', true)
|
||||
->get();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Data pegawai berhasil diambil',
|
||||
'data' => $data
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat mengambil data pegawai',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDetailPegawai($id)
|
||||
{
|
||||
try {
|
||||
$pegawai = Ms_Pegawai::where('statusenabled', true)->findOrFail($id);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Data pegawai ditemukan',
|
||||
'data' => $pegawai
|
||||
], 200);
|
||||
} catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
|
||||
return response()->json([
|
||||
'message' => 'Pegawai tidak ditemukan'
|
||||
], 404);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat mengambil data pegawai',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function pegawaiBaru(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'NamaPegawai' => 'required|string|max:100',
|
||||
'id_jenis_pegawai' => 'required',
|
||||
]);
|
||||
|
||||
$pegawai = Ms_Pegawai::create([
|
||||
'NamaPegawai' => $validated['NamaPegawai'],
|
||||
'id_jenis_pegawai' => $validated['id_jenis_pegawai'],
|
||||
'statusenabled' => true,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Pegawai berhasil ditambahkan',
|
||||
'data' => $pegawai
|
||||
], 201);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat menyimpan pegawai',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function updatePegawai(Request $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'NamaPegawai' => 'required|string|max:100',
|
||||
]);
|
||||
|
||||
$pegawai = Ms_Pegawai::findOrFail($id);
|
||||
|
||||
$pegawai->update([
|
||||
'NamaPegawai' => $validated['NamaPegawai'],
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Pegawai berhasil diperbarui',
|
||||
'data' => $pegawai
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat memperbarui pegawai',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function hapusPegawai($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$pegawai = Ms_Pegawai::findOrFail($id);
|
||||
|
||||
$pegawai->statusenabled = false;
|
||||
$pegawai->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Pegawai berhasil di-nonaktifkan',
|
||||
'data' => $pegawai
|
||||
], 200);
|
||||
|
||||
} catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Pegawai tidak ditemukan'
|
||||
], 404);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat menghapus pegawai',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
182
backend/app/Http/Controllers/RegistrasiController.php
Normal file
182
backend/app/Http/Controllers/RegistrasiController.php
Normal file
@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\TrRegistrasi;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RegistrasiController extends Controller
|
||||
{
|
||||
// 🔥 Get semua data registrasi dengan relasi
|
||||
public function getRegistrasi()
|
||||
{
|
||||
try {
|
||||
$data = TrRegistrasi::with([
|
||||
'pasien',
|
||||
'pegawai',
|
||||
'kamar',
|
||||
'tempatTidur',
|
||||
'ruanganPelayanan',
|
||||
'asuransi'
|
||||
])
|
||||
->where('statusenabled', true)
|
||||
->get();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Data registrasi berhasil diambil',
|
||||
'data' => $data,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Gagal mengambil data registrasi',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
// 🔥 Get detail registrasi by ID
|
||||
public function getDetailRegistrasi($id)
|
||||
{
|
||||
try {
|
||||
$data = TrRegistrasi::with([
|
||||
'pasien',
|
||||
'pegawai',
|
||||
'kamar',
|
||||
'tempatTidur',
|
||||
'ruanganPelayanan',
|
||||
'asuransi'
|
||||
])->findOrFail($id);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Detail registrasi ditemukan',
|
||||
'data' => $data,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Registrasi tidak ditemukan',
|
||||
'error' => $e->getMessage(),
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
// 🔥 Tambah registrasi baru dengan mrpasien dari URL
|
||||
public function addRegistrasi(Request $request, $mrpasien)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'TanggalRegistrasi' => 'required|date',
|
||||
'NomorKartuAsuransi' => 'nullable|string|max:255',
|
||||
'IdAsuransi' => 'required|exists:ms__asuransis,IdAsuransi',
|
||||
'IdPegawai' => 'required|exists:ms__pegawais,IdPegawai',
|
||||
'IdRuangPelayanan' => 'required|exists:ms__ruang_pelayanans,IdRuangPelayanan',
|
||||
'JenisRawat' => 'required|in:rawat_jalan,rawat_inap',
|
||||
'IdKamar' => 'nullable|exists:ms__kamars,id',
|
||||
'IdTempatTidur' => 'nullable|exists:ms__tempat_tidurs,id',
|
||||
]);
|
||||
|
||||
// Generate NoRegistrasi
|
||||
$tanggal = now()->format('dmY');
|
||||
$countToday = TrRegistrasi::whereDate('TanggalRegistrasi', now())->count() + 1;
|
||||
$noUrut = str_pad($countToday, 3, '0', STR_PAD_LEFT);
|
||||
$noReg = $tanggal . $noUrut;
|
||||
|
||||
$registrasi = TrRegistrasi::create([
|
||||
'NoRegistrasi' => $noReg,
|
||||
'TanggalRegistrasi' => $validated['TanggalRegistrasi'],
|
||||
'MRPasien' => $mrpasien,
|
||||
'NomorKartuAsuransi' => $validated['NomorKartuAsuransi'] ?? null,
|
||||
'IdAsuransi' => $validated['IdAsuransi'],
|
||||
'IdPegawai' => $validated['IdPegawai'],
|
||||
'IdRuangPelayanan' => $validated['IdRuangPelayanan'],
|
||||
'JenisRawat' => $validated['JenisRawat'],
|
||||
'IdKamar' => $validated['JenisRawat'] == 'rawat_inap' ? $validated['IdKamar'] : null,
|
||||
'IdTempatTidur' => $validated['JenisRawat'] == 'rawat_inap' ? $validated['IdTempatTidur'] : null,
|
||||
'statusenabled' => true,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Registrasi berhasil ditambahkan',
|
||||
'data' => $registrasi,
|
||||
], 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal menambahkan registrasi',
|
||||
'error' => $e->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
// 🔥 Update registrasi
|
||||
public function updateRegistrasi(Request $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'TanggalRegistrasi' => 'required|date',
|
||||
'NomorKartuAsuransi' => 'nullable|string|max:255',
|
||||
'IdAsuransi' => 'required|exists:ms__asuransis,IdAsuransi',
|
||||
'IdPegawai' => 'required|exists:ms__pegawais,IdPegawai',
|
||||
'IdRuangPelayanan' => 'required|exists:ms__ruang_pelayanans,IdRuangPelayanan',
|
||||
'JenisRawat' => 'required|in:rawat_jalan,rawat_inap',
|
||||
'IdKamar' => 'nullable|exists:ms__kamars,id',
|
||||
'IdTempatTidur' => 'nullable|exists:ms__tempat_tidurs,id',
|
||||
]);
|
||||
|
||||
$registrasi = TrRegistrasi::findOrFail($id);
|
||||
|
||||
$registrasi->update([
|
||||
'TanggalRegistrasi' => $validated['TanggalRegistrasi'],
|
||||
'NomorKartuAsuransi' => $validated['NomorKartuAsuransi'] ?? null,
|
||||
'IdAsuransi' => $validated['IdAsuransi'],
|
||||
'IdPegawai' => $validated['IdPegawai'],
|
||||
'IdRuangPelayanan' => $validated['IdRuangPelayanan'],
|
||||
'JenisRawat' => $validated['JenisRawat'],
|
||||
'IdKamar' => $validated['JenisRawat'] == 'rawat_inap' ? $validated['IdKamar'] : null,
|
||||
'IdTempatTidur' => $validated['JenisRawat'] == 'rawat_inap' ? $validated['IdTempatTidur'] : null,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Registrasi berhasil diperbarui',
|
||||
'data' => $registrasi,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal update registrasi',
|
||||
'error' => $e->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
// 🔥 Hapus registrasi (nonaktifkan)
|
||||
public function hapusRegistrasi($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$registrasi = TrRegistrasi::findOrFail($id);
|
||||
$registrasi->statusenabled = false;
|
||||
$registrasi->save();
|
||||
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'message' => 'Registrasi berhasil dinonaktifkan',
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal menghapus registrasi',
|
||||
'error' => $e->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
159
backend/app/Http/Controllers/RuangPelayananController.php
Normal file
159
backend/app/Http/Controllers/RuangPelayananController.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Ms_RuangPelayanan;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RuangPelayananController extends Controller
|
||||
{
|
||||
public function getRuangPelayanan()
|
||||
{
|
||||
try {
|
||||
$data = Ms_RuangPelayanan::with('departemen')->where('statusenabled', true)->get();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Data ruang pelayanan berhasil diambil',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Gagal ambil data ruang',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getDetailRuangPelayanan($id)
|
||||
{
|
||||
try {
|
||||
$ruang = Ms_RuangPelayanan::with('departemen')->where('statusenabled', true)->findOrFail($id);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Data ruang ditemukan',
|
||||
'data' => $ruang
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Ruang tidak ditemukan',
|
||||
'error' => $e->getMessage()
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahRuangPelayanan(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'NamaRuangPelayanan' => 'required|string|max:100',
|
||||
'departemen_id' => 'required',
|
||||
]);
|
||||
|
||||
$ruang = Ms_RuangPelayanan::create([
|
||||
'NamaRuangPelayanan' => $validated['NamaRuangPelayanan'],
|
||||
'departemen_id' => $validated['departemen_id'],
|
||||
'statusenabled' => true,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Ruang pelayanan berhasil ditambahkan',
|
||||
'data' => $ruang
|
||||
], 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal tambah ruang',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateRuangPelayanan(Request $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'NamaRuangPelayanan' => 'required|string|max:100',
|
||||
'departemen_id' => 'required',
|
||||
]);
|
||||
|
||||
$ruang = Ms_RuangPelayanan::findOrFail($id);
|
||||
|
||||
$ruang->update([
|
||||
'NamaRuangPelayanan' => $validated['NamaRuangPelayanan'],
|
||||
'departemen_id' => $validated['departemen_id'],
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Ruang pelayanan berhasil diperbarui',
|
||||
'data' => $ruang
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal update ruang',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function hapusRuangPelayanan($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
try {
|
||||
$ruang = Ms_RuangPelayanan::findOrFail($id);
|
||||
$ruang->statusenabled = false;
|
||||
$ruang->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Ruang pelayanan berhasil dinonaktifkan',
|
||||
'data' => $ruang
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal hapus ruang',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getRuanganRegistrasi(Request $request)
|
||||
{
|
||||
$jenisRawat = $request->jenis;
|
||||
|
||||
$departemenId = [];
|
||||
|
||||
if ($jenisRawat === 'rawat_jalan') {
|
||||
$departemenId = [1, 3];
|
||||
} elseif ($jenisRawat === 'rawat_inap') {
|
||||
$departemenId = [2];
|
||||
} else {
|
||||
return response()->json([
|
||||
'message' => 'Jenis rawat tidak valid',
|
||||
], 400);
|
||||
}
|
||||
|
||||
$data = \App\Models\Ms_RuangPelayanan::where('statusenabled', true)
|
||||
->whereIn('departemen_id', $departemenId)
|
||||
->get();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Data ruangan berhasil diambil',
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
121
backend/app/Http/Controllers/TempatTidurController.php
Normal file
121
backend/app/Http/Controllers/TempatTidurController.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Ms_TempatTidur;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class TempatTidurController extends Controller
|
||||
{
|
||||
public function getTempatTidur()
|
||||
{
|
||||
try {
|
||||
$data = Ms_TempatTidur::with('kamar')->where('statusenabled', true)->get();
|
||||
return response()->json([
|
||||
'message' => 'Data tempat tidur berhasil diambil',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Gagal ambil data tempat tidur',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function tambahTempatTidur(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'nama_tempat_tidur' => 'required|string|max:100',
|
||||
'kamar_id' => 'required|numeric',
|
||||
'status' => 'required|string|in:kosong,terisi', // Validasi status
|
||||
]);
|
||||
|
||||
// Ambil tempat tidur terakhir berdasarkan id dan generate kode
|
||||
$lastTempatTidur = Ms_TempatTidur::orderBy('id', 'desc')->first();
|
||||
$nextNumber = $lastTempatTidur ? $lastTempatTidur->id + 1 : 1;
|
||||
$kodeTempatTidur = 'TT-' . str_pad($nextNumber, 3, '0', STR_PAD_LEFT); // Format kode TT-001
|
||||
|
||||
$tempatTidur = Ms_TempatTidur::create([
|
||||
'nama_tempat_tidur' => $validated['nama_tempat_tidur'],
|
||||
'kode_tempat_tidur' => $kodeTempatTidur, // Menyimpan kode unik
|
||||
'status' => $validated['status'],
|
||||
'kamar_id' => $validated['kamar_id'],
|
||||
'statusenabled' => true,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Tempat tidur berhasil ditambahkan',
|
||||
'data' => $tempatTidur
|
||||
], 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal tambah tempat tidur',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function updateTempatTidur(Request $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'nama_tempat_tidur' => 'required|string|max:100',
|
||||
'kamar_id' => 'required|numeric',
|
||||
'status' => 'required|string|in:kosong,terisi', // Validasi status
|
||||
]);
|
||||
|
||||
$tempatTidur = Ms_TempatTidur::findOrFail($id);
|
||||
|
||||
$tempatTidur->update([
|
||||
'nama_tempat_tidur' => $validated['nama_tempat_tidur'],
|
||||
'kamar_id' => $validated['kamar_id'],
|
||||
'status' => $validated['status'],
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Tempat tidur berhasil diperbarui',
|
||||
'data' => $tempatTidur
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal update tempat tidur',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function hapusTempatTidur($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$tempatTidur = Ms_TempatTidur::findOrFail($id);
|
||||
$tempatTidur->statusenabled = false;
|
||||
$tempatTidur->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Tempat tidur berhasil dinonaktifkan',
|
||||
'data' => $tempatTidur
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal hapus tempat tidur',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
120
backend/app/Http/Controllers/TindakanController.php
Normal file
120
backend/app/Http/Controllers/TindakanController.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Ms_Tindakan;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class TindakanController extends Controller
|
||||
{
|
||||
public function getTindakan()
|
||||
{
|
||||
try {
|
||||
$data = Ms_Tindakan::where('statusenabled', true)->get();
|
||||
return response()->json([
|
||||
'message' => 'Data tindakan berhasil diambil',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Terjadi kesalahan saat mengambil data tindakan',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getDetailTindakan($id)
|
||||
{
|
||||
try {
|
||||
$data = Ms_Tindakan::findOrFail($id);
|
||||
return response()->json([
|
||||
'message' => 'Data tindakan ditemukan',
|
||||
'data' => $data
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Tindakan tidak ditemukan',
|
||||
'error' => $e->getMessage()
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
public function tindakanBaru(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'NamaTindakan' => 'required|string|max:100',
|
||||
'TarifTindakan' => 'required|numeric|min:0',
|
||||
]);
|
||||
|
||||
$tindakan = Ms_Tindakan::create([
|
||||
'NamaTindakan' => $validated['NamaTindakan'],
|
||||
'TarifTindakan' => $validated['TarifTindakan'],
|
||||
'statusenabled' => true,
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Tindakan berhasil ditambahkan',
|
||||
'data' => $tindakan
|
||||
], 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal tambah tindakan',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateTindakan(Request $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'NamaTindakan' => 'required|string|max:100',
|
||||
'TarifTindakan' => 'required|numeric|min:0',
|
||||
]);
|
||||
|
||||
$tindakan = Ms_Tindakan::findOrFail($id);
|
||||
$tindakan->update($validated);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Tindakan berhasil diperbarui',
|
||||
'data' => $tindakan
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal update tindakan',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function hapusTindakan($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$tindakan = Ms_Tindakan::findOrFail($id);
|
||||
$tindakan->update(['statusenabled' => false]);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Tindakan berhasil di-nonaktifkan'
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal hapus tindakan',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
127
backend/app/Http/Controllers/TransaksiController.php
Normal file
127
backend/app/Http/Controllers/TransaksiController.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Tr_Transaksi;
|
||||
use App\Models\TrRegistrasi;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class TransaksiController extends Controller
|
||||
{
|
||||
public function getTransaksi()
|
||||
{
|
||||
$data = Tr_Transaksi::with(['tindakan', 'pegawai', 'registrasi.pasien'])
|
||||
->where('statusenabled', true)
|
||||
->get();
|
||||
|
||||
|
||||
return response()->json(['data' => $data]);
|
||||
}
|
||||
|
||||
public function transaksiBaru(Request $request)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'IdRegistrasi' => 'required|exists:tr_registrasis,IdRegistrasi',
|
||||
'IdTindakan' => 'required|exists:ms__tindakans,IdTindakan',
|
||||
'JmlTindakan' => 'required|integer|min:1',
|
||||
'IdPegawai' => 'required|exists:ms__pegawais,IdPegawai',
|
||||
]);
|
||||
|
||||
// Mengambil tarif tindakan dari tabel ms__tindakans
|
||||
$tindakan = \App\Models\Ms_Tindakan::findOrFail($validated['IdTindakan']);
|
||||
$total = $tindakan->Tarif * $validated['JmlTindakan'];
|
||||
|
||||
$transaksi = Tr_Transaksi::create([
|
||||
'IdRegistrasi' => $validated['IdRegistrasi'],
|
||||
'IdTindakan' => $validated['IdTindakan'],
|
||||
'JmlTindakan' => $validated['JmlTindakan'],
|
||||
'IdPegawai' => $validated['IdPegawai'],
|
||||
'Total' => $total,
|
||||
'statusenabled' => true
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'message' => 'Transaksi berhasil ditambahkan',
|
||||
'data' => $transaksi
|
||||
], 201);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal tambah transaksi',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateTransaksi(Request $request, $id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$validated = $request->validate([
|
||||
'IdTindakan' => 'required|exists:ms__tindakans,IdTindakan',
|
||||
'JmlTindakan' => 'required|integer|min:1',
|
||||
'IdPegawai' => 'required|exists:ms__pegawais,IdPegawai',
|
||||
]);
|
||||
|
||||
$transaksi = Tr_Transaksi::findOrFail($id);
|
||||
$transaksi->update([
|
||||
'IdTindakan' => $validated['IdTindakan'],
|
||||
'JmlTindakan' => $validated['JmlTindakan'],
|
||||
'IdPegawai' => $validated['IdPegawai']
|
||||
]);
|
||||
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'message' => 'Transaksi berhasil diperbarui',
|
||||
'data' => $transaksi
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal update transaksi',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function hapusTransaksi($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$transaksi = Tr_Transaksi::findOrFail($id);
|
||||
$transaksi->update(['statusenabled' => false]);
|
||||
|
||||
DB::commit();
|
||||
return response()->json([
|
||||
'message' => 'Transaksi berhasil di-nonaktifkan'
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
return response()->json([
|
||||
'message' => 'Gagal hapus transaksi',
|
||||
'error' => $e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function printBilling($id)
|
||||
{
|
||||
$registrasi = TrRegistrasi::with('pasien', 'ruanganPelayanan')->findOrFail($id);
|
||||
|
||||
$transaksiList = Tr_Transaksi::with(['tindakan', 'pegawai'])
|
||||
->where('IdRegistrasi', $id)
|
||||
->where('statusenabled', true)
|
||||
->get();
|
||||
|
||||
return view('billing-print', [
|
||||
'registrasi' => $registrasi,
|
||||
'transaksiList' => $transaksiList,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
68
backend/app/Http/Kernel.php
Normal file
68
backend/app/Http/Kernel.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
];
|
||||
}
|
||||
21
backend/app/Http/Middleware/Authenticate.php
Normal file
21
backend/app/Http/Middleware/Authenticate.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
}
|
||||
}
|
||||
}
|
||||
17
backend/app/Http/Middleware/EncryptCookies.php
Normal file
17
backend/app/Http/Middleware/EncryptCookies.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
32
backend/app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
32
backend/app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @param string|null ...$guards
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ...$guards)
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
19
backend/app/Http/Middleware/TrimStrings.php
Normal file
19
backend/app/Http/Middleware/TrimStrings.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
||||
20
backend/app/Http/Middleware/TrustHosts.php
Normal file
20
backend/app/Http/Middleware/TrustHosts.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
||||
28
backend/app/Http/Middleware/TrustProxies.php
Normal file
28
backend/app/Http/Middleware/TrustProxies.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
||||
17
backend/app/Http/Middleware/VerifyCsrfToken.php
Normal file
17
backend/app/Http/Middleware/VerifyCsrfToken.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
18
backend/app/Models/Ms_Asuransi.php
Normal file
18
backend/app/Models/Ms_Asuransi.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ms_Asuransi extends Model
|
||||
{
|
||||
protected $table = 'ms__asuransis';
|
||||
protected $primaryKey = 'IdAsuransi';
|
||||
|
||||
protected $fillable = [
|
||||
'NamaAsuransi',
|
||||
'statusenabled'
|
||||
];
|
||||
|
||||
}
|
||||
18
backend/app/Models/Ms_Departemen.php
Normal file
18
backend/app/Models/Ms_Departemen.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ms_Departemen extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'ms__departemens';
|
||||
|
||||
protected $fillable = [
|
||||
'nama_departemen',
|
||||
'statusenabled'
|
||||
];
|
||||
}
|
||||
24
backend/app/Models/Ms_JenisPegawai.php
Normal file
24
backend/app/Models/Ms_JenisPegawai.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ms_JenisPegawai extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'ms__jenis_pegawais'; // pastikan table name sesuai migrasi
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $fillable = [
|
||||
'nama_jenis',
|
||||
'statusenabled'
|
||||
];
|
||||
|
||||
public function pegawai()
|
||||
{
|
||||
return $this->hasMany(Ms_Pegawai::class, 'id_jenis_pegawai');
|
||||
}
|
||||
}
|
||||
30
backend/app/Models/Ms_Kamar.php
Normal file
30
backend/app/Models/Ms_Kamar.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ms_Kamar extends Model
|
||||
{
|
||||
protected $table = 'ms__kamars';
|
||||
|
||||
protected $fillable = [
|
||||
'nama_kamar',
|
||||
'ruangan_id',
|
||||
'kelas_id',
|
||||
'kode_kamar',
|
||||
'jumlah_tempat_tidur',
|
||||
'statusenabled',
|
||||
];
|
||||
|
||||
public function ruangan()
|
||||
{
|
||||
return $this->belongsTo(Ms_RuangPelayanan::class, 'ruangan_id');
|
||||
}
|
||||
|
||||
|
||||
public function kelas()
|
||||
{
|
||||
return $this->belongsTo(Ms_Kelas::class, 'kelas_id');
|
||||
}
|
||||
}
|
||||
23
backend/app/Models/Ms_Kelas.php
Normal file
23
backend/app/Models/Ms_Kelas.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ms_Kelas extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'ms__kelas';
|
||||
|
||||
protected $fillable = [
|
||||
'nama_kelas',
|
||||
'statusenabled',
|
||||
];
|
||||
|
||||
public function kamar()
|
||||
{
|
||||
return $this->hasMany(\App\Models\Ms_Kamar::class, 'kelas_id');
|
||||
}
|
||||
}
|
||||
28
backend/app/Models/Ms_Pasien.php
Normal file
28
backend/app/Models/Ms_Pasien.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ms_Pasien extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'ms__pasiens';
|
||||
protected $primaryKey = 'MRPasien';
|
||||
public $incrementing = false;
|
||||
protected $keyType = 'string';
|
||||
|
||||
protected $fillable = [
|
||||
'MRPasien',
|
||||
'NoRM',
|
||||
'NamaPasien',
|
||||
'TanggalLahir',
|
||||
'JenisKelamin',
|
||||
'Alamat',
|
||||
'NoHP',
|
||||
'statusenabled',
|
||||
];
|
||||
|
||||
}
|
||||
24
backend/app/Models/Ms_Pegawai.php
Normal file
24
backend/app/Models/Ms_Pegawai.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ms_Pegawai extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'ms__pegawais';
|
||||
protected $primaryKey = 'IdPegawai';
|
||||
|
||||
protected $fillable = [
|
||||
'NamaPegawai',
|
||||
'id_jenis_pegawai',
|
||||
'statusenabled',
|
||||
];
|
||||
|
||||
public function jenisPegawai()
|
||||
{
|
||||
return $this->belongsTo(Ms_JenisPegawai::class, 'id_jenis_pegawai');
|
||||
}
|
||||
}
|
||||
27
backend/app/Models/Ms_RuangPelayanan.php
Normal file
27
backend/app/Models/Ms_RuangPelayanan.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ms_RuangPelayanan extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'ms__ruang_pelayanans';
|
||||
protected $primaryKey = 'IdRuangPelayanan';
|
||||
public $incrementing = true;
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
'NamaRuangPelayanan',
|
||||
'departemen_id',
|
||||
'statusenabled',
|
||||
];
|
||||
|
||||
public function departemen()
|
||||
{
|
||||
return $this->belongsTo(Ms_Departemen::class, 'departemen_id');
|
||||
}
|
||||
}
|
||||
23
backend/app/Models/Ms_TempatTidur.php
Normal file
23
backend/app/Models/Ms_TempatTidur.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ms_TempatTidur extends Model
|
||||
{
|
||||
protected $table = 'ms__tempat_tidurs';
|
||||
|
||||
protected $fillable = [
|
||||
'nama_tempat_tidur',
|
||||
'kode_tempat_tidur',
|
||||
'status',
|
||||
'kamar_id',
|
||||
'statusenabled',
|
||||
];
|
||||
|
||||
public function kamar()
|
||||
{
|
||||
return $this->belongsTo(Ms_Kamar::class, 'kamar_id');
|
||||
}
|
||||
}
|
||||
20
backend/app/Models/Ms_Tindakan.php
Normal file
20
backend/app/Models/Ms_Tindakan.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ms_Tindakan extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'ms__tindakans';
|
||||
protected $primaryKey = 'IdTindakan';
|
||||
|
||||
protected $fillable = [
|
||||
'NamaTindakan',
|
||||
'TarifTindakan',
|
||||
'statusenabled',
|
||||
];
|
||||
}
|
||||
78
backend/app/Models/TrRegistrasi.php
Normal file
78
backend/app/Models/TrRegistrasi.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class TrRegistrasi extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tr_registrasis';
|
||||
|
||||
protected $primaryKey = 'IdRegistrasi';
|
||||
public $incrementing = false;
|
||||
protected $keyType = 'string';
|
||||
|
||||
protected $fillable = [
|
||||
'IdRegistrasi',
|
||||
'NoRegistrasi',
|
||||
'TanggalRegistrasi',
|
||||
'MRPasien',
|
||||
'NomorKartuAsuransi',
|
||||
'IdAsuransi',
|
||||
'IdPegawai',
|
||||
'IdRuangPelayanan',
|
||||
'IdKamar',
|
||||
'IdTempatTidur',
|
||||
'JenisRawat',
|
||||
'statusenabled',
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
if (empty($model->{$model->getKeyName()})) {
|
||||
$model->{$model->getKeyName()} = (string) Str::uuid();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// =======================
|
||||
// RELATIONS
|
||||
// =======================
|
||||
|
||||
public function kamar()
|
||||
{
|
||||
return $this->belongsTo(Ms_Kamar::class, 'IdKamar');
|
||||
}
|
||||
|
||||
public function tempatTidur()
|
||||
{
|
||||
return $this->belongsTo(Ms_TempatTidur::class, 'IdTempatTidur');
|
||||
}
|
||||
|
||||
public function ruanganPelayanan()
|
||||
{
|
||||
return $this->belongsTo(Ms_RuangPelayanan::class, 'IdRuangPelayanan');
|
||||
}
|
||||
|
||||
public function pasien()
|
||||
{
|
||||
return $this->belongsTo(Ms_Pasien::class, 'MRPasien', 'MRPasien');
|
||||
}
|
||||
|
||||
public function asuransi()
|
||||
{
|
||||
return $this->belongsTo(Ms_Asuransi::class, 'IdAsuransi');
|
||||
}
|
||||
|
||||
public function pegawai()
|
||||
{
|
||||
return $this->belongsTo(Ms_Pegawai::class, 'IdPegawai');
|
||||
}
|
||||
}
|
||||
39
backend/app/Models/Tr_Transaksi.php
Normal file
39
backend/app/Models/Tr_Transaksi.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Tr_Transaksi extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tr__transaksis';
|
||||
protected $primaryKey = 'IdTransaksi';
|
||||
|
||||
protected $fillable = [
|
||||
'IdRegistrasi',
|
||||
'IdTindakan',
|
||||
'JmlTindakan',
|
||||
'IdPegawai',
|
||||
'Total',
|
||||
'statusenabled',
|
||||
];
|
||||
|
||||
public function tindakan()
|
||||
{
|
||||
return $this->belongsTo(Ms_Tindakan::class, 'IdTindakan');
|
||||
}
|
||||
|
||||
public function pegawai()
|
||||
{
|
||||
return $this->belongsTo(Ms_Pegawai::class, 'IdPegawai');
|
||||
}
|
||||
|
||||
public function registrasi()
|
||||
{
|
||||
return $this->belongsTo(TrRegistrasi::class, 'IdRegistrasi');
|
||||
}
|
||||
|
||||
}
|
||||
45
backend/app/Models/User.php
Normal file
45
backend/app/Models/User.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'id_pegawai',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
28
backend/app/Providers/AppServiceProvider.php
Normal file
28
backend/app/Providers/AppServiceProvider.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
30
backend/app/Providers/AuthServiceProvider.php
Normal file
30
backend/app/Providers/AuthServiceProvider.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [
|
||||
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
21
backend/app/Providers/BroadcastServiceProvider.php
Normal file
21
backend/app/Providers/BroadcastServiceProvider.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
32
backend/app/Providers/EventServiceProvider.php
Normal file
32
backend/app/Providers/EventServiceProvider.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array<class-string, array<int, class-string>>
|
||||
*/
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
63
backend/app/Providers/RouteServiceProvider.php
Normal file
63
backend/app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
*
|
||||
* This is used by Laravel authentication to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/home';
|
||||
|
||||
/**
|
||||
* The controller namespace for the application.
|
||||
*
|
||||
* When present, controller route declarations will automatically be prefixed with this namespace.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
// protected $namespace = 'App\\Http\\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the rate limiters for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
||||
53
backend/artisan
Normal file
53
backend/artisan
Normal file
@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register The Auto Loader
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Composer provides a convenient, automatically generated class loader
|
||||
| for our application. We just need to utilize it! We'll require it
|
||||
| into the script here so that we do not have to worry about the
|
||||
| loading of any of our classes manually. It's great to relax.
|
||||
|
|
||||
*/
|
||||
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Artisan Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When we run the console application, the current CLI command will be
|
||||
| executed in this console and the response sent back to a terminal
|
||||
| or another output device for the developers. Here goes nothing!
|
||||
|
|
||||
*/
|
||||
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
|
||||
$status = $kernel->handle(
|
||||
$input = new Symfony\Component\Console\Input\ArgvInput,
|
||||
new Symfony\Component\Console\Output\ConsoleOutput
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Shutdown The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Once Artisan has finished running, we will fire off the shutdown events
|
||||
| so that any final work may be done by the application before we shut
|
||||
| down the process. This is the last thing to happen to the request.
|
||||
|
|
||||
*/
|
||||
|
||||
$kernel->terminate($input, $status);
|
||||
|
||||
exit($status);
|
||||
55
backend/bootstrap/app.php
Normal file
55
backend/bootstrap/app.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The first thing we will do is create a new Laravel application instance
|
||||
| which serves as the "glue" for all the components of Laravel, and is
|
||||
| the IoC container for the system binding all of the various parts.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = new Illuminate\Foundation\Application(
|
||||
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bind Important Interfaces
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, we need to bind some important interfaces into the container so
|
||||
| we will be able to resolve them when needed. The kernels serve the
|
||||
| incoming requests to this application from both the web and CLI.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Http\Kernel::class,
|
||||
App\Http\Kernel::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Console\Kernel::class,
|
||||
App\Console\Kernel::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||
App\Exceptions\Handler::class
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Return The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This script returns the application instance. The instance is given to
|
||||
| the calling script so we can separate the building of the instances
|
||||
| from the actual running of the application and sending responses.
|
||||
|
|
||||
*/
|
||||
|
||||
return $app;
|
||||
2
backend/bootstrap/cache/.gitignore
vendored
Normal file
2
backend/bootstrap/cache/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
63
backend/composer.json
Normal file
63
backend/composer.json
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The Laravel Framework.",
|
||||
"keywords": ["framework", "laravel"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.3|^8.0",
|
||||
"barryvdh/laravel-dompdf": "0.9.0",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"laravel/framework": "^8.75",
|
||||
"laravel/sanctum": "^2.15",
|
||||
"laravel/tinker": "^2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"facade/ignition": "^2.5",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^5.10",
|
||||
"phpunit/phpunit": "^9.5.10"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
8059
backend/composer.lock
generated
Normal file
8059
backend/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
235
backend/config/app.php
Normal file
235
backend/config/app.php
Normal file
@ -0,0 +1,235 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application. This value is used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| any other location as required by the application or its packages.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| your application so that it is used when running Artisan tasks.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
'asset_url' => env('ASSET_URL', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. We have gone
|
||||
| ahead and set this to a sensible default for you out of the box.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by the translation service provider. You are free to set this value
|
||||
| to any of the locales which will be supported by the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Fallback Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The fallback locale determines the locale to use when the current one
|
||||
| is not available. You may change the value to correspond to any of
|
||||
| the language folders that are provided through your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'fallback_locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Faker Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This locale will be used by the Faker PHP library when generating fake
|
||||
| data for your database seeds. For example, this will be used to get
|
||||
| localized telephone numbers, street address information and more.
|
||||
|
|
||||
*/
|
||||
|
||||
'faker_locale' => 'en_US',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is used by the Illuminate encrypter service and should be set
|
||||
| to a random, 32 character string, otherwise these encrypted strings
|
||||
| will not be safe. Please do this before deploying an application!
|
||||
|
|
||||
*/
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The service providers listed here will be automatically loaded on the
|
||||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
||||
/*
|
||||
* Laravel Framework Service Providers...
|
||||
*/
|
||||
Illuminate\Auth\AuthServiceProvider::class,
|
||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||
Illuminate\Bus\BusServiceProvider::class,
|
||||
Illuminate\Cache\CacheServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
||||
Illuminate\Cookie\CookieServiceProvider::class,
|
||||
Illuminate\Database\DatabaseServiceProvider::class,
|
||||
Illuminate\Encryption\EncryptionServiceProvider::class,
|
||||
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
||||
Illuminate\Hashing\HashServiceProvider::class,
|
||||
Illuminate\Mail\MailServiceProvider::class,
|
||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
||||
Illuminate\Queue\QueueServiceProvider::class,
|
||||
Illuminate\Redis\RedisServiceProvider::class,
|
||||
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
||||
Illuminate\Session\SessionServiceProvider::class,
|
||||
Illuminate\Translation\TranslationServiceProvider::class,
|
||||
Illuminate\Validation\ValidationServiceProvider::class,
|
||||
Illuminate\View\ViewServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Class Aliases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array of class aliases will be registered when this application
|
||||
| is started. However, feel free to register as many as you wish as
|
||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||
|
|
||||
*/
|
||||
|
||||
'aliases' => [
|
||||
|
||||
'App' => Illuminate\Support\Facades\App::class,
|
||||
'Arr' => Illuminate\Support\Arr::class,
|
||||
'Artisan' => Illuminate\Support\Facades\Artisan::class,
|
||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
|
||||
'Bus' => Illuminate\Support\Facades\Bus::class,
|
||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||
'Config' => Illuminate\Support\Facades\Config::class,
|
||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||
'Date' => Illuminate\Support\Facades\Date::class,
|
||||
'DB' => Illuminate\Support\Facades\DB::class,
|
||||
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
||||
'Event' => Illuminate\Support\Facades\Event::class,
|
||||
'File' => Illuminate\Support\Facades\File::class,
|
||||
'Gate' => Illuminate\Support\Facades\Gate::class,
|
||||
'Hash' => Illuminate\Support\Facades\Hash::class,
|
||||
'Http' => Illuminate\Support\Facades\Http::class,
|
||||
'Js' => Illuminate\Support\Js::class,
|
||||
'Lang' => Illuminate\Support\Facades\Lang::class,
|
||||
'Log' => Illuminate\Support\Facades\Log::class,
|
||||
'Mail' => Illuminate\Support\Facades\Mail::class,
|
||||
'Notification' => Illuminate\Support\Facades\Notification::class,
|
||||
'Password' => Illuminate\Support\Facades\Password::class,
|
||||
'Queue' => Illuminate\Support\Facades\Queue::class,
|
||||
'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class,
|
||||
'Redirect' => Illuminate\Support\Facades\Redirect::class,
|
||||
// 'Redis' => Illuminate\Support\Facades\Redis::class,
|
||||
'Request' => Illuminate\Support\Facades\Request::class,
|
||||
'Response' => Illuminate\Support\Facades\Response::class,
|
||||
'Route' => Illuminate\Support\Facades\Route::class,
|
||||
'Schema' => Illuminate\Support\Facades\Schema::class,
|
||||
'Session' => Illuminate\Support\Facades\Session::class,
|
||||
'Storage' => Illuminate\Support\Facades\Storage::class,
|
||||
'Str' => Illuminate\Support\Str::class,
|
||||
'URL' => Illuminate\Support\Facades\URL::class,
|
||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
111
backend/config/auth.php
Normal file
111
backend/config/auth.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default authentication "guard" and password
|
||||
| reset options for your application. You may change these defaults
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => 'web',
|
||||
'passwords' => 'users',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| here which uses session storage and the Eloquent user provider.
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| Supported: "session"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| sources which represent each model / table. These sources may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\Models\User::class,
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may specify multiple password reset configurations if you have more
|
||||
| than one user table or model in the application and you want to have
|
||||
| separate password reset settings based on the specific user types.
|
||||
|
|
||||
| The expire time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => 'password_resets',
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the amount of seconds before a password confirmation
|
||||
| times out and the user is prompted to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => 10800,
|
||||
|
||||
];
|
||||
64
backend/config/broadcasting.php
Normal file
64
backend/config/broadcasting.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Broadcaster
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default broadcaster that will be used by the
|
||||
| framework when an event needs to be broadcast. You may set this to
|
||||
| any of the connections defined in the "connections" array below.
|
||||
|
|
||||
| Supported: "pusher", "ably", "redis", "log", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('BROADCAST_DRIVER', 'null'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the broadcast connections that will be used
|
||||
| to broadcast events to other systems or over websockets. Samples of
|
||||
| each available type of connection are provided inside this array.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'pusher' => [
|
||||
'driver' => 'pusher',
|
||||
'key' => env('PUSHER_APP_KEY'),
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||
'useTLS' => true,
|
||||
],
|
||||
],
|
||||
|
||||
'ably' => [
|
||||
'driver' => 'ably',
|
||||
'key' => env('ABLY_KEY'),
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'driver' => 'log',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'null',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
110
backend/config/cache.php
Normal file
110
backend/config/cache.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache connection that gets used while
|
||||
| using this caching library. This connection is used when another is
|
||||
| not explicitly specified when executing a given caching function.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "apc", "array", "database", "file",
|
||||
| "memcached", "redis", "dynamodb", "octane", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'apc' => [
|
||||
'driver' => 'apc',
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'cache',
|
||||
'connection' => null,
|
||||
'lock_connection' => null,
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'cache',
|
||||
'lock_connection' => 'default',
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing a RAM based store such as APC or Memcached, there might
|
||||
| be other applications utilizing the same cache. So, we'll specify a
|
||||
| value to get prefixed to all our keys so we can avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
|
||||
|
||||
];
|
||||
34
backend/config/cors.php
Normal file
34
backend/config/cors.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cross-Origin Resource Sharing (CORS) Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure your settings for cross-origin resource sharing
|
||||
| or "CORS". This determines what cross-origin operations may execute
|
||||
| in web browsers. You are free to adjust these settings as needed.
|
||||
|
|
||||
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
||||
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
'allowed_origins' => ['http://localhost:5173'],
|
||||
|
||||
'allowed_origins_patterns' => [],
|
||||
|
||||
'allowed_headers' => ['*'],
|
||||
|
||||
'exposed_headers' => [],
|
||||
|
||||
'max_age' => 0,
|
||||
|
||||
'supports_credentials' => true,
|
||||
|
||||
];
|
||||
147
backend/config/database.php
Normal file
147
backend/config/database.php
Normal file
@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for all database work. Of course
|
||||
| you may use many connections at once using the Database library.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'mysql'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here are each of the database connections setup for your application.
|
||||
| Of course, examples of configuring each database platform that is
|
||||
| supported by Laravel is shown below to make development simple.
|
||||
|
|
||||
|
|
||||
| All database work in Laravel is done through the PHP PDO facilities
|
||||
| so make sure you have the driver for your particular database of
|
||||
| choice installed on your machine before you begin development.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'schema' => 'public',
|
||||
'sslmode' => 'prefer',
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run in the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => 'migrations',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'password' => env('REDIS_PASSWORD', null),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'password' => env('REDIS_PASSWORD', null),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
73
backend/config/filesystems.php
Normal file
73
backend/config/filesystems.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application. Just store away!
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DRIVER', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure as many filesystem "disks" as you wish, and you
|
||||
| may even configure multiple disks of the same driver. Defaults have
|
||||
| been setup for each driver as an example of the required options.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
||||
52
backend/config/hashing.php
Normal file
52
backend/config/hashing.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Hash Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default hash driver that will be used to hash
|
||||
| passwords for your application. By default, the bcrypt algorithm is
|
||||
| used; however, you remain free to modify this option if you wish.
|
||||
|
|
||||
| Supported: "bcrypt", "argon", "argon2id"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'bcrypt',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bcrypt Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'bcrypt' => [
|
||||
'rounds' => env('BCRYPT_ROUNDS', 10),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Argon Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Argon algorithm. These will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'argon' => [
|
||||
'memory' => 65536,
|
||||
'threads' => 1,
|
||||
'time' => 4,
|
||||
],
|
||||
|
||||
];
|
||||
118
backend/config/logging.php
Normal file
118
backend/config/logging.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that gets used when writing
|
||||
| messages to the logs. The name specified in this option should match
|
||||
| one of the channels defined in the "channels" configuration array.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Out of
|
||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||
| you a variety of powerful log handlers / formatters to utilize.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog",
|
||||
| "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['single'],
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => 14,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => 'Laravel Log',
|
||||
'emoji' => ':boom:',
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => SyslogUdpHandler::class,
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
118
backend/config/mail.php
Normal file
118
backend/config/mail.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send any email
|
||||
| messages sent by your application. Alternative mailers may be setup
|
||||
| and used as needed; however, this mailer will be used by default.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'smtp'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers to be used while
|
||||
| sending an e-mail. You will specify which one you are using for your
|
||||
| mailers below. You are free to add additional mailers as required.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
||||
| "postmark", "log", "array", "failover"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
'port' => env('MAIL_PORT', 587),
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'auth_mode' => null,
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'mailgun' => [
|
||||
'transport' => 'mailgun',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -t -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all e-mails sent by your application to be sent from
|
||||
| the same address. Here, you may specify a name and address that is
|
||||
| used globally for all e-mails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Markdown Mail Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using Markdown based email rendering, you may configure your
|
||||
| theme and component paths here, allowing you to customize the design
|
||||
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||
|
|
||||
*/
|
||||
|
||||
'markdown' => [
|
||||
'theme' => 'default',
|
||||
|
||||
'paths' => [
|
||||
resource_path('views/vendor/mail'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
93
backend/config/queue.php
Normal file
93
backend/config/queue.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue API supports an assortment of back-ends via a single
|
||||
| API, giving you convenient access to each back-end using the same
|
||||
| syntax for every one. Here you may define a default connection.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'sync'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection information for each server that
|
||||
| is used by your application. A default configuration has been added
|
||||
| for each back-end shipped with Laravel. You are free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'jobs',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
'block_for' => 0,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'default'),
|
||||
'suffix' => env('SQS_SUFFIX'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => 90,
|
||||
'block_for' => null,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control which database and table are used to store the jobs that
|
||||
| have failed. You may change them to any database / table you wish.
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
||||
65
backend/config/sanctum.php
Normal file
65
backend/config/sanctum.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Stateful Domains
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Requests from the following domains / hosts will receive stateful API
|
||||
| authentication cookies. Typically, these should include your local
|
||||
| and production domains which access your API via a frontend SPA.
|
||||
|
|
||||
*/
|
||||
|
||||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||
'%s%s',
|
||||
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||
env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : ''
|
||||
))),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array contains the authentication guards that will be checked when
|
||||
| Sanctum is trying to authenticate a request. If none of these guards
|
||||
| are able to authenticate the request, Sanctum will use the bearer
|
||||
| token that's present on an incoming request for authentication.
|
||||
|
|
||||
*/
|
||||
|
||||
'guard' => ['web'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Expiration Minutes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value controls the number of minutes until an issued token will be
|
||||
| considered expired. If this value is null, personal access tokens do
|
||||
| not expire. This won't tweak the lifetime of first-party sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'expiration' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When authenticating your first-party SPA with Sanctum you may need to
|
||||
| customize some of the middleware Sanctum uses while processing the
|
||||
| request. You may change the middleware listed below as required.
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
|
||||
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
|
||||
],
|
||||
|
||||
];
|
||||
33
backend/config/services.php
Normal file
33
backend/config/services.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'mailgun' => [
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
'secret' => env('MAILGUN_SECRET'),
|
||||
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'token' => env('POSTMARK_TOKEN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
];
|
||||
201
backend/config/session.php
Normal file
201
backend/config/session.php
Normal file
@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default session "driver" that will be used on
|
||||
| requests. By default, we will use the lightweight native driver but
|
||||
| you may specify any of the other wonderful drivers provided here.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "apc",
|
||||
| "memcached", "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to immediately expire on the browser closing, set that option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it is stored. All encryption will be run
|
||||
| automatically by Laravel and you can use the Session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the native session driver, we need a location where session
|
||||
| files may be stored. A default has been set for you but a different
|
||||
| location may be specified. This is only needed for file sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table we
|
||||
| should use to manage the sessions. Of course, a sensible default is
|
||||
| provided for you; however, you are free to change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => 'sessions',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using one of the framework's cache driven session backends you may
|
||||
| list a cache store that should be used for these sessions. This value
|
||||
| must match with one of the application's configured cache "stores".
|
||||
|
|
||||
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the cookie used to identify a session
|
||||
| instance by ID. The name specified here will get used every time a
|
||||
| new session cookie is created by the framework for every driver.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application but you are free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => '/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the domain of the cookie used to identify a session
|
||||
| in your application. This will determine which domains the cookie is
|
||||
| available to in your application. A sensible default has been set.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. You are free to modify this option if needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" since this is a secure default value.
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => 'lax',
|
||||
|
||||
];
|
||||
36
backend/config/view.php
Normal file
36
backend/config/view.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| View Storage Paths
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Most templating systems load templates from disk. Here you may specify
|
||||
| an array of paths that should be checked for your views. Of course
|
||||
| the usual Laravel view path has already been registered for you.
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => [
|
||||
resource_path('views'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Compiled View Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines where all the compiled Blade templates will be
|
||||
| stored for your application. Typically, this is within the storage
|
||||
| directory. However, as usual, you are free to change this value.
|
||||
|
|
||||
*/
|
||||
|
||||
'compiled' => env(
|
||||
'VIEW_COMPILED_PATH',
|
||||
realpath(storage_path('framework/views'))
|
||||
),
|
||||
|
||||
];
|
||||
1
backend/database/.gitignore
vendored
Normal file
1
backend/database/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
39
backend/database/factories/UserFactory.php
Normal file
39
backend/database/factories/UserFactory.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->name(),
|
||||
'email' => $this->faker->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
public function unverified()
|
||||
{
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'email_verified_at' => null,
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->unsignedBigInteger('id_pegawai');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateFailedJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
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.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePersonalAccessTokensTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMsPasiensTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ms__pasiens', function (Blueprint $table) {
|
||||
$table->string('MRPasien')->primary();
|
||||
$table->string('NoRM', 10)->unique();
|
||||
$table->string('NamaPasien', 100);
|
||||
$table->date('TanggalLahir');
|
||||
$table->string('JenisKelamin', 10);
|
||||
$table->string('Alamat', 255)->nullable();
|
||||
$table->string('NoHP', 20)->nullable();
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ms__pasiens');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMsAsuransisTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ms__asuransis', function (Blueprint $table) {
|
||||
$table->bigIncrements('IdAsuransi');
|
||||
$table->string('NamaAsuransi');
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ms__asuransis');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMsPegawaisTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ms__pegawais', function (Blueprint $table) {
|
||||
$table->bigIncrements('IdPegawai');
|
||||
$table->string('NamaPegawai');
|
||||
$table->unsignedBigInteger('id_jenis_pegawai');
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ms__pegawais');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMsRuangPelayanansTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ms__ruang_pelayanans', function (Blueprint $table) {
|
||||
$table->bigIncrements('IdRuangPelayanan');
|
||||
$table->string('NamaRuangPelayanan');
|
||||
$table->unsignedBigInteger('departemen_id');
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ms__ruang_pelayanans');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMsJenisPegawaisTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ms__jenis_pegawais', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('nama_jenis', 100);
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ms__jenis_pegawais');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMsDepartemensTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ms__departemens', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('nama_departemen', 100);
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ms__departemens');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMsKelasTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ms__kelas', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('nama_kelas', 50);
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ms__kelas');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMsKamarsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ms__kamars', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('nama_kamar', 100);
|
||||
$table->unsignedBigInteger('ruangan_id');
|
||||
$table->unsignedBigInteger('kelas_id');
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ms__kamars');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateTrRegistrasisTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tr_registrasis', function (Blueprint $table) {
|
||||
$table->uuid('IdRegistrasi')->primary();
|
||||
$table->string('NoRegistrasi')->unique();
|
||||
$table->date('TanggalRegistrasi');
|
||||
$table->string('MRPasien');
|
||||
$table->string('NomorKartuAsuransi')->nullable();
|
||||
$table->unsignedBigInteger('IdAsuransi');
|
||||
$table->unsignedBigInteger('IdPegawai');
|
||||
$table->unsignedBigInteger('IdRuangPelayanan');
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('MRPasien')->references('MRPasien')->on('ms__pasiens')->onDelete('restrict');
|
||||
$table->foreign('IdAsuransi')->references('IdAsuransi')->on('ms__asuransis')->onDelete('restrict');
|
||||
$table->foreign('IdPegawai')->references('IdPegawai')->on('ms__pegawais')->onDelete('restrict');
|
||||
$table->foreign('IdRuangPelayanan')->references('IdRuangPelayanan')->on('ms__ruang_pelayanans')->onDelete('restrict');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tr_registrasis');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMsTindakansTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ms__tindakans', function (Blueprint $table) {
|
||||
$table->bigIncrements('IdTindakan');
|
||||
$table->string('NamaTindakan');
|
||||
$table->decimal('TarifTindakan', 12, 2)->default(0);
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ms__tindakans');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateTrTransaksisTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tr__transaksis', function (Blueprint $table) {
|
||||
$table->bigIncrements('IdTransaksi');
|
||||
$table->uuid('IdRegistrasi');
|
||||
$table->unsignedBigInteger('IdTindakan');
|
||||
$table->unsignedInteger('JmlTindakan');
|
||||
$table->unsignedBigInteger('IdPegawai');
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('IdRegistrasi')->references('IdRegistrasi')->on('tr_registrasis')->onDelete('restrict');
|
||||
$table->foreign('IdTindakan')->references('IdTindakan')->on('ms__tindakans')->onDelete('restrict');
|
||||
$table->foreign('IdPegawai')->references('IdPegawai')->on('ms__pegawais')->onDelete('restrict');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tr__transaksis');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMsTempatTidursTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ms__tempat_tidurs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('nama_tempat_tidur', 100);
|
||||
$table->unsignedBigInteger('kamar_id');
|
||||
$table->boolean('statusenabled')->default(true);
|
||||
$table->timestamps();
|
||||
$table->foreign('kamar_id')->references('id')->on('ms__kamars');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ms__tempat_tidurs');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFieldsToMsKamarsMsTempatTidursTrRegistrasis extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
|
||||
Schema::table('ms__kamars', function (Blueprint $table) {
|
||||
$table->string('kode_kamar', 50)->nullable()->after('nama_kamar');
|
||||
$table->integer('jumlah_tempat_tidur')->nullable()->after('kelas_id');
|
||||
});
|
||||
|
||||
|
||||
Schema::table('ms__tempat_tidurs', function (Blueprint $table) {
|
||||
$table->string('kode_tempat_tidur', 50)->nullable()->after('nama_tempat_tidur');
|
||||
$table->enum('status', ['kosong', 'isi'])->default('kosong')->after('kode_tempat_tidur');
|
||||
$table->boolean('aktif')->default(true)->after('status');
|
||||
$table->text('keterangan')->nullable()->after('aktif');
|
||||
});
|
||||
|
||||
|
||||
Schema::table('tr_registrasis', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('IdKamar')->nullable()->after('IdRuangPelayanan');
|
||||
$table->unsignedBigInteger('IdTempatTidur')->nullable()->after('IdKamar');
|
||||
|
||||
$table->foreign('IdKamar')->references('id')->on('ms__kamars')->onDelete('restrict');
|
||||
$table->foreign('IdTempatTidur')->references('id')->on('ms__tempat_tidurs')->onDelete('restrict');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
|
||||
Schema::table('ms__kamars', function (Blueprint $table) {
|
||||
$table->dropColumn(['kode_kamar', 'jumlah_tempat_tidur']);
|
||||
});
|
||||
|
||||
Schema::table('ms__tempat_tidurs', function (Blueprint $table) {
|
||||
$table->dropColumn(['kode_tempat_tidur', 'status', 'aktif', 'keterangan']);
|
||||
});
|
||||
|
||||
Schema::table('tr_registrasis', function (Blueprint $table) {
|
||||
$table->dropForeign(['IdKamar']);
|
||||
$table->dropForeign(['IdTempatTidur']);
|
||||
$table->dropColumn(['IdKamar', 'IdTempatTidur']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddJenisRawatToTrRegistrasis extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tr_registrasis', function (Blueprint $table) {
|
||||
$table->enum('JenisRawat', ['rawat_jalan', 'rawat_inap'])->default('rawat_jalan');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tr_registrasis', function (Blueprint $table) {
|
||||
$table->dropColumn('JenisRawat');
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTotalToTrTransaksisTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tr__transaksis', function (Blueprint $table) {
|
||||
$table->decimal('Total', 15, 2)->nullable()->after('JmlTindakan');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tr__transaksis', function (Blueprint $table) {
|
||||
$table->dropColumn('Total');
|
||||
});
|
||||
}
|
||||
}
|
||||
33
backend/database/seeders/AsuransiSeeder.php
Normal file
33
backend/database/seeders/AsuransiSeeder.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AsuransiSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
DB::table('ms__asuransis')->insert([
|
||||
[
|
||||
'NamaAsuransi' => 'BPJS Kesehatan',
|
||||
'statusenabled' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
],
|
||||
[
|
||||
'NamaAsuransi' => 'Asuransi Swasta ABC',
|
||||
'statusenabled' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
],
|
||||
[
|
||||
'NamaAsuransi' => 'Umum / Pribadi',
|
||||
'statusenabled' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now()
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
27
backend/database/seeders/DatabaseSeeder.php
Normal file
27
backend/database/seeders/DatabaseSeeder.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
$this->call([
|
||||
JenisPegawaiSeeder::class,
|
||||
DepartemenSeeder::class,
|
||||
KelasSeeder::class,
|
||||
AsuransiSeeder::class,
|
||||
RuangPelayananSeeder::class,
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
24
backend/database/seeders/DepartemenSeeder.php
Normal file
24
backend/database/seeders/DepartemenSeeder.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Ms_Departemen;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DepartemenSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('ms__departemens')->insert([
|
||||
['nama_departemen' => 'Rajal', 'statusenabled' => true],
|
||||
['nama_departemen' => 'Ranap', 'statusenabled' => true],
|
||||
['nama_departemen' => 'IGD', 'statusenabled' => true],
|
||||
]);
|
||||
}
|
||||
}
|
||||
24
backend/database/seeders/JenisPegawaiSeeder.php
Normal file
24
backend/database/seeders/JenisPegawaiSeeder.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class JenisPegawaiSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('ms__jenis_pegawais')->insert([
|
||||
['nama_jenis' => 'Admin', 'statusenabled' => true, 'created_at' => now(), 'updated_at' => now()],
|
||||
['nama_jenis' => 'Dokter', 'statusenabled' => true, 'created_at' => now(), 'updated_at' => now()],
|
||||
['nama_jenis' => 'Farmasi', 'statusenabled' => true, 'created_at' => now(), 'updated_at' => now()],
|
||||
['nama_jenis' => 'Kasir', 'statusenabled' => true, 'created_at' => now(), 'updated_at' => now()],
|
||||
]);
|
||||
}
|
||||
}
|
||||
24
backend/database/seeders/KelasSeeder.php
Normal file
24
backend/database/seeders/KelasSeeder.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class KelasSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('ms__kelas')->insert([
|
||||
['nama_kelas' => 'VIP', 'statusenabled' => true, 'created_at' => now(), 'updated_at' => now()],
|
||||
['nama_kelas' => 'Kelas 1', 'statusenabled' => true, 'created_at' => now(), 'updated_at' => now()],
|
||||
['nama_kelas' => 'Kelas 2', 'statusenabled' => true, 'created_at' => now(), 'updated_at' => now()],
|
||||
['nama_kelas' => 'Kelas 3', 'statusenabled' => true, 'created_at' => now(), 'updated_at' => now()],
|
||||
]);
|
||||
}
|
||||
}
|
||||
73
backend/database/seeders/RuangPelayananSeeder.php
Normal file
73
backend/database/seeders/RuangPelayananSeeder.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RuangPelayananSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('ms__ruang_pelayanans')->insert([
|
||||
|
||||
[
|
||||
'NamaRuangPelayanan' => 'Poli Anak',
|
||||
'departemen_id' => 1,
|
||||
'statusenabled' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'NamaRuangPelayanan' => 'Poli Umum',
|
||||
'departemen_id' => 1,
|
||||
'statusenabled' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'NamaRuangPelayanan' => 'Poli Gigi',
|
||||
'departemen_id' => 1,
|
||||
'statusenabled' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
|
||||
|
||||
[
|
||||
'NamaRuangPelayanan' => 'Kamar Inap A',
|
||||
'departemen_id' => 2,
|
||||
'statusenabled' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'NamaRuangPelayanan' => 'Kamar Inap B',
|
||||
'departemen_id' => 2,
|
||||
'statusenabled' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'NamaRuangPelayanan' => 'Kamar Inap VIP',
|
||||
'departemen_id' => 2,
|
||||
'statusenabled' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'NamaRuangPelayanan' => 'Instalasi Gawat Darurat (IGD)',
|
||||
'departemen_id' => 3,
|
||||
'statusenabled' => true,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
18
backend/package.json
Normal file
18
backend/package.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "mix",
|
||||
"watch": "mix watch",
|
||||
"watch-poll": "mix watch -- --watch-options-poll=1000",
|
||||
"hot": "mix watch --hot",
|
||||
"prod": "npm run production",
|
||||
"production": "mix --production"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.21",
|
||||
"laravel-mix": "^6.0.6",
|
||||
"lodash": "^4.17.19",
|
||||
"postcss": "^8.1.14"
|
||||
}
|
||||
}
|
||||
31
backend/phpunit.xml
Normal file
31
backend/phpunit.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">./app</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<php>
|
||||
<server name="APP_ENV" value="testing"/>
|
||||
<server name="BCRYPT_ROUNDS" value="4"/>
|
||||
<server name="CACHE_DRIVER" value="array"/>
|
||||
<!-- <server name="DB_CONNECTION" value="sqlite"/> -->
|
||||
<!-- <server name="DB_DATABASE" value=":memory:"/> -->
|
||||
<server name="MAIL_MAILER" value="array"/>
|
||||
<server name="QUEUE_CONNECTION" value="sync"/>
|
||||
<server name="SESSION_DRIVER" value="array"/>
|
||||
<server name="TELESCOPE_ENABLED" value="false"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
21
backend/public/.htaccess
Normal file
21
backend/public/.htaccess
Normal file
@ -0,0 +1,21 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Send Requests To Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
0
backend/public/favicon.ico
Normal file
0
backend/public/favicon.ico
Normal file
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user