This commit is contained in:
lucki wahyu m 2024-06-26 15:20:54 +07:00
commit 66fd973bb4
919 changed files with 367785 additions and 0 deletions

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,122 @@
<?php
namespace App\Http\Controllers;
use App\Models\Pembayaran;
use App\Models\Pemeriksaan;
use App\Models\Pasien;
use App\Models\Obat;
use App\Models\Resep;
use App\Models\Tindakan;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\App;
class DetailPembayaranController extends Controller
{
public function index(Request $request)
{
$periksaId = $request['id_periksa'];
$no = 1;
$pemeriksaan = Pemeriksaan::select('*', 'pemeriksaan.id as id_periksa', DB::raw('(SELECT status FROM pembayaran WHERE pembayaran.id_periksa = pemeriksaan.id) as statuspembayaran'))
->leftJoin('pasien', 'pasien.id', 'pemeriksaan.pasien_id')
->where('pemeriksaan.id', $periksaId)
->orderBy('pemeriksaan.created_at', 'desc')
->first();
$pasien = Pasien::find($pemeriksaan->pasien_id);
$obat = Resep::leftJoin('obat', 'obat.id', 'resepobat.id_obat')->where('id_periksa', $periksaId)->get();
$harga = Tindakan::select('harga', 'nama_tindakan')->whereIn('nama_tindakan', $pemeriksaan->tindakan)->get();
$pemeriksaan->total_harga_tindakan = 0;
$hargatindakan = [];
$namatindakan = [];
foreach ($harga as $item) {
$namatindakan[] = $item->nama_tindakan;
if ($pasien->askes == "Dana_Sehat") {
if ($item->nama_tindakan == "periksa" || $item->nama_tindakan == "pemeriksaan dan konsultasi") {
$hargatindakan[] = 0;
$pemeriksaan->total_harga_tindakan += 0;
} else {
$hargatindakan[] = $item->harga;
$pemeriksaan->total_harga_tindakan += $item->harga;
}
} else {
$hargatindakan[] = $item->harga;
$pemeriksaan->total_harga_tindakan += $item->harga;
}
}
$pemeriksaan->hargatindakan = $hargatindakan;
$pemeriksaan->namatindakan = $namatindakan;
return view('pages.detailpembayaran', compact('no', 'pemeriksaan', 'pasien', 'obat'));
}
public function store(Request $request)
{
$data = $request->all();
Pembayaran::create($data);
return redirect()->route('pembayaran.index');
}
public function cetak($id)
{
App::setLocale('id');
// $periksaId = $request['id_periksa'];
$no = 1;
$kunjungan = Resep::select('resepobat.id_periksa', 'pemeriksaan.no_periksa', 'users.name as nama_dokter', 'pemeriksaan.tindakan', 'pemeriksaan.tindakan', 'pembayaran.status as statuspembayaran', 'pasien.nama_pasien', 'pasien.no_rmd', 'pemeriksaan.status as statuspemeriksaan', 'resepobat.status as statusobat', 'pemeriksaan.tgl_kunjungan', 'resepobat.pembelian as pembelian', 'pasien.askes', 'pemeriksaan.waktu_kunjungan', DB::raw('SUM(obat.harga) as total_harga_obat'))
->join('pemeriksaan', 'resepobat.id_periksa', '=', 'pemeriksaan.id')
->join('pasien', 'pemeriksaan.pasien_id', '=', 'pasien.id') // Join dengan tabel resepobat
->join('obat', 'resepobat.id_obat', '=', 'obat.id')
->join('users', 'pemeriksaan.user_id', '=', 'users.id')
->leftJoin('pembayaran', 'pemeriksaan.id', '=', 'pembayaran.id_periksa') // Left join dengan tabel pembayaran
->groupBy('pemeriksaan.no_periksa', 'resepobat.id_periksa', 'pemeriksaan.pasien_id', 'pembayaran.status', 'pasien.nama_pasien', 'pasien.no_rmd', 'pemeriksaan.status', 'resepobat.status', 'pembelian', 'pemeriksaan.tgl_kunjungan', 'pasien.askes', 'pemeriksaan.waktu_kunjungan')
->where('resepobat.id_periksa', $id)
->get();
$resep = Resep::select('resepobat.id_periksa', 'pemeriksaan.no_periksa', 'pasien.nama_pasien', 'pemeriksaan.status as statuspemeriksaan', 'obat.nama_obat', 'obat.harga', 'resepobat.aturanpakai', 'resepobat.jumlah', 'resepobat.deskripsi', 'pemeriksaan.tgl_kunjungan', 'pemeriksaan.waktu_kunjungan', 'pembelian')
->join('pemeriksaan', 'resepobat.id_periksa', '=', 'pemeriksaan.id')
->join('pasien', 'pemeriksaan.pasien_id', '=', 'pasien.id')
->join('obat', 'resepobat.id_obat', '=', 'obat.id')
->where('resepobat.id_periksa', $id)
->get();
foreach ($kunjungan as $data) {
// if ($data->askes == "Dana_Sehat") {
// $harga = Tindakan::select('harga')->where('nama_tindakan','!=','periksa')->whereIn('nama_tindakan', json_decode($data->tindakan, true))->get();
// }else {
$harga = Tindakan::select('harga', 'nama_tindakan')->whereIn('nama_tindakan', json_decode($data->tindakan, true))->get();
// }
$data->total_harga_tindakan = 0;
$hargatindakan = [];
$namatindakan = [];
// $data->hargatindakan = $harga->harga;
foreach ($harga as $item) {
$namatindakan[] = $item->nama_tindakan;
if ($data->askes == "Dana_Sehat") {
if ($item->nama_tindakan == "periksa" || $item->nama_tindakan == "pemeriksaan dan konsultasi") {
$hargatindakan[] = 0;
$data->total_harga_tindakan += 0;
} else {
$hargatindakan[] = $item->harga;
$data->total_harga_tindakan += $item->harga;
}
} else {
$hargatindakan[] = $item->harga;
$data->total_harga_tindakan += $item->harga;
}
}
$data->hargatindakan = $hargatindakan;
$data->namatindakan = $namatindakan;
}
return view('pages.cetaknota', compact('kunjungan', 'no', 'resep'));
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers;
use App\Models\Resep;
use App\Models\Pemeriksaan;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class DetailPeriksaController extends Controller
{
public function index(Request $request)
{
$periksaId = $request['id_periksa'];
// dd($periksaId);
$no = 1;
$kunjungan = Pemeriksaan::with('pasien')->where('id',$periksaId)->get();
return view('pages.detailperiksa', compact('kunjungan', 'no'));
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace App\Http\Controllers;
use App\Models\Resep;
use App\Models\Tindakan;
use App\Models\Pembayaran;
use App\Models\Pasien;
use App\Models\Pemeriksaan;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\App;
class DetailRekamMedisController extends Controller
{
public function index(Request $request)
{
$no_rmd = $request['no_rmd'];
$pasien = Pasien::where('no_rmd', $no_rmd)->first();
$kunjunganpasien = Pemeriksaan::select('*',
DB::raw('
(
SELECT JSON_ARRAYAGG(
JSON_OBJECT(
"id", resepobat.id,
"nama_obat", (SELECT nama_obat FROM obat WHERE obat.id = resepobat.id_obat),
"deskripsi", resepobat.deskripsi,
"aturanpakai", resepobat.aturanpakai,
"jumlah", resepobat.jumlah
)
)
FROM resepobat
WHERE resepobat.id_periksa = pemeriksaan.id
) as resep
')
)->where('pasien_id', $pasien->id)->get();
// print_r($kunjunganpasien); die();
// dd($periksaId);
$no = 1;
return view('pages.detailrekmed', compact('kunjunganpasien', 'no', 'pasien'));
}
public function cetak($no_rmd)
{
App::setLocale('id');
$id = 1;
$pasien = Pasien::where('no_rmd', $no_rmd)->first();
$kunjunganpasien = Pemeriksaan::select('*',
DB::raw('
(
SELECT JSON_ARRAYAGG(
JSON_OBJECT(
"id", resepobat.id,
"nama_obat", (SELECT nama_obat FROM obat WHERE obat.id = resepobat.id_obat),
"deskripsi", resepobat.deskripsi,
"aturanpakai", resepobat.aturanpakai,
"jumlah", resepobat.jumlah
)
)
FROM resepobat
WHERE resepobat.id_periksa = pemeriksaan.id
) as resep
')
)->where('pasien_id', $pasien->id)->get();
// dd($periksaId);
$no = 1;
return view('pages.cetakrekammedis', compact('no', 'kunjunganpasien', 'pasien'));
}
public function store(Request $request)
{
$data = $request->all();
Pembayaran::create($data);
return redirect()->route('detailpembayaran.index');
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace App\Http\Controllers;
use App\Models\Resep;
use App\Models\Pemeriksaan;
use Illuminate\Http\Request;
class DetailresepobatController extends Controller
{
public function index(Request $request)
{
$no = 1;
// dd($request['id_periksa']);
$periksaId = $request['id_periksa'];
// dd($periksaId);
$resep = Resep::select('resepobat.id_periksa', 'pemeriksaan.no_periksa', 'pasien.nama_pasien', 'pasien.usia', 'pemeriksaan.bb', 'pemeriksaan.td', 'pemeriksaan.nadi', 'pemeriksaan.alergi', 'pemeriksaan.status as statuspemeriksaan', 'obat.nama_obat', 'resepobat.aturanpakai','resepobat.jumlah', 'obat.satuan', 'resepobat.deskripsi', 'pemeriksaan.tgl_kunjungan', 'pemeriksaan.waktu_kunjungan')
->join('pemeriksaan', 'resepobat.id_periksa', '=', 'pemeriksaan.id')
->join('pasien', 'pemeriksaan.pasien_id', '=', 'pasien.id')
->join('obat', 'resepobat.id_obat', '=', 'obat.id')
->where('resepobat.id_periksa', $periksaId)
->get();
$kunjungan = Resep::select('pemeriksaan.no_periksa', 'pasien.nama_pasien', 'pasien.usia', 'pemeriksaan.bb', 'pemeriksaan.td', 'pemeriksaan.nadi', 'pemeriksaan.alergi')
->join('pemeriksaan', 'resepobat.id_periksa', '=', 'pemeriksaan.id')
->join('pasien', 'pemeriksaan.pasien_id', '=', 'pasien.id')
->groupBy('pemeriksaan.no_periksa', 'pasien.nama_pasien', 'pasien.usia', 'pemeriksaan.bb', 'pemeriksaan.td', 'pemeriksaan.nadi', 'pemeriksaan.alergi')
->where('resepobat.id_periksa', $periksaId)
->get();
$periksa = Pemeriksaan::with('pasien')->orderBy('created_at', 'desc')->get();
return view('pages.detailresepobat', compact(
'no',
'kunjungan',
'periksa',
'resep'
));
}
public function cetak($id)
{
$no = 1;
// dd($request['id_periksa']);
// $periksaId = $request['id_periksa'];
// dd($id);
$resep = Resep::select('resepobat.id_periksa', 'pemeriksaan.no_periksa', 'pasien.nama_pasien', 'pemeriksaan.status as statuspemeriksaan', 'obat.nama_obat', 'resepobat.aturanpakai', 'resepobat.jumlah', 'pasien.usia', 'pemeriksaan.bb', 'pemeriksaan.td', 'pemeriksaan.nadi', 'pemeriksaan.alergi', 'obat.satuan', 'resepobat.deskripsi', 'pemeriksaan.tgl_kunjungan', 'pemeriksaan.waktu_kunjungan')
->join('pemeriksaan', 'resepobat.id_periksa', '=', 'pemeriksaan.id')
->join('pasien', 'pemeriksaan.pasien_id', '=', 'pasien.id')
->join('obat', 'resepobat.id_obat', '=', 'obat.id')
->where('resepobat.id_periksa', $id)
->get();
$kunjungan = Resep::select('pemeriksaan.no_periksa', 'pasien.nama_pasien', 'resepobat.id_periksa', 'pasien.usia', 'pemeriksaan.bb', 'pemeriksaan.td', 'pemeriksaan.nadi', 'pemeriksaan.alergi')
->join('pemeriksaan', 'resepobat.id_periksa', '=', 'pemeriksaan.id')
->join('pasien', 'pemeriksaan.pasien_id', '=', 'pasien.id')
->groupBy('pemeriksaan.no_periksa', 'pasien.nama_pasien', 'resepobat.id_periksa', 'pasien.usia', 'pemeriksaan.bb', 'pemeriksaan.td', 'pemeriksaan.nadi', 'pemeriksaan.alergi')
->where('resepobat.id_periksa', $id)
->get();
return view('pages.cetakResep', compact(
'no',
'kunjungan',
'resep'
));
}
}

View File

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

View File

@ -0,0 +1,112 @@
<?php
namespace App\Http\Controllers;
use App\Models\Obat;
use App\Models\Pasien;
use App\Models\Pembayaran;
use App\Models\Pemeriksaan;
use App\Models\Resep;
use Illuminate\Http\Request;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index(Request $request)
{
// Mendapatkan bulan dan tahun saat ini
$currentMonth = Carbon::now()->month;
$currentYear = Carbon::now()->year;
$role = auth()->user()->role; // Mengambil peran (role) pengguna yang sudah login
// Menghitung jumlah pasien berdasarkan bulan dan tahun saat ini
$pasien = Pasien::count();
$user = User::count();
$count = Pemeriksaan::where('status', '2')
->whereMonth('created_at', $currentMonth)
->whereYear('created_at', $currentYear)
->count();
$resep = Resep::groupBy('id_periksa')
->select('id_periksa', DB::raw('COUNT(*) as total'))
->get()
->count();
$pembeliansendiri = Resep::where('pembelian', 'sendiri')
->groupBy('id_periksa')
->select('id_periksa', DB::raw('COUNT(*) as total'))
->get()
->count();
$pembelianapotek = Resep::where('pembelian', 'apotek')
->groupBy('id_periksa')
->select('id_periksa', DB::raw('COUNT(*) as total'))
->get()
->count();
$pendapatan = Pembayaran::where('status' ,'sudah bayar')->get()->sum('total');
$pendapatanbulan = Pembayaran::where('status' ,'sudah bayar')
->whereMonth('created_at', $currentMonth)
->get()->sum('total');
$jumlahobat = Obat::get()->count();
$pemeriksaan = Pemeriksaan::whereIn('status', ['0', '1'])->get()->count();
$per = Pemeriksaan::get()->count();
$pemeriksaandone = Pemeriksaan::where('status', '2')->get()->count();
$pemeriksaanwait = Pemeriksaan::where('status', '0')->get()->count();
$pemeriksaanperiksa = Pemeriksaan::where('status', '1')->get()->count();
$pembayarandone = Pembayaran::where('status', 'sudah bayar')->get()->count();
$pembayaranwait = Pembayaran::where('status', 'belum')->get()->count();
$jumlahIdPeriksa = DB::table('pemeriksaan')
->leftJoin('pembayaran', 'pemeriksaan.id', '=', 'pembayaran.id_periksa')
->whereNull('pembayaran.id_periksa')
->count('pemeriksaan.id');
$penyakitterbanyak = Pemeriksaan::select(
'diagnosa',
DB::raw('count(*) as total'),
DB::raw('(SELECT kode FROM data_penyakit WHERE data_penyakit.nama_penyakit = diagnosa LIMIT 1) as kode')
)
->groupBy('diagnosa')
->orderBy('total', 'desc') // Mengurutkan berdasarkan total dalam urutan menurun
->limit(10);
$tahun = $request->input('tahun');
if ($tahun) {
$penyakitterbanyak->whereYear('tgl_kunjungan', $tahun);
}
$penyakitterbanyak = $penyakitterbanyak->get();
// Mengarahkan pengguna berdasarkan peran (role)
if ($role === 'dokter') {
return view('pages.dashboard-dokter', compact('pasien', 'pemeriksaan', 'pemeriksaandone', 'resep'));
} elseif ($role === 'perawat') {
return view('pages.dashboard-perawat', compact('pemeriksaandone', 'pemeriksaanwait', 'pemeriksaanperiksa'));
} elseif ($role === 'admin') {
return view('pages.dashboard-admin', compact('pendapatanbulan','pendapatan','pasien', 'count', 'pembayarandone', 'pembayaranwait','jumlahIdPeriksa','user', 'penyakitterbanyak'));
} elseif ($role === 'apoteker') {
return view('pages.dashboard-apoteker', compact('jumlahobat', 'pembeliansendiri', 'pembelianapotek'));
} else {
// Pengguna tidak memiliki peran yang sesuai, lakukan sesuai kebijakan aplikasi Anda
}
}
}

View File

@ -0,0 +1,123 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Pemeriksaan;
use App\Models\User;
use App\Models\Pasien;
use Illuminate\Support\Str;
use Carbon\Carbon;
class KunjunganController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$dokter = User::where('role', 'dokter')
->where('status', 'aktif')->get();
$pasien = Pasien::get();
$kunjungan = Pemeriksaan::with('pasien')->latest()->get(); // Mengambil data kunjungan dengan urutan berdasarkan waktu pembuatan, dengan yang terbaru di atas
return view('pages.kunjungan', compact('kunjungan', 'no', 'dokter', 'pasien'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Mengambil tanggal kunjungan dari request
$today = $request->input('tgl_kunjungan');
// Mencari kunjungan terakhir pada tanggal yang sama
$lastVisitToday = Pemeriksaan::whereDate('tgl_kunjungan', $today)
->orderBy('id', 'desc')
->first();
// Mengatur nomor antrian berikutnya
$nextQueueNumber = '001';
if ($lastVisitToday) {
// Jika ada kunjungan sebelumnya hari ini, ambil nomor antrian terakhir dan tambahkan 1
$lastQueueNumber = substr($lastVisitToday->no_antrian, -3); // Mendapatkan 3 digit terakhir dari nomor antrian terakhir
$nextQueueNumber = str_pad((int)$lastQueueNumber + 1, 3, '0', STR_PAD_LEFT); // Tambahkan 1 dan pastikan format nomor antrian adalah 3 digit
}
// Membuat data kunjungan baru dengan nomor antrian yang telah di-generate
$data = $request->all();
$data['no_antrian'] = $nextQueueNumber;
$data['no_periksa'] = Str::random(5);
Pemeriksaan::create($data);
// Dapatkan nama pasien yang terkait dengan kunjungan baru
$pasien = Pasien::findOrFail($data['pasien_id'])->nama_pasien;
// Berikan pesan bahwa kunjungan baru telah ditambahkan sesuai dengan nama pasien
return redirect()->route('kunjungan.index')->with('success', 'Kunjungan baru untuk ' . $pasien . ' dengan nomor antrian ' . $nextQueueNumber . ' telah ditambahkan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('kunjungan.index')->with('error', 'Gagal menambahkan kunjungan: ' . $e->getMessage());
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
public function update(Request $request, $id)
{
$user = Pemeriksaan::findOrFail($id);
$user->update($request->all());
return redirect()->route('kunjungan.index')->with('success', 'User updated successfully');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
try {
$data = Pemeriksaan::findOrFail($id);
$nama_pasien = $data->pasien->nama_pasien; // Dapatkan nama pasien yang terkait dengan kunjungan yang akan dihapus
$data->delete();
// Berikan pesan bahwa kunjungan telah dihapus sesuai dengan nama pasien
return redirect()->route('kunjungan.index')->with('success', 'Kunjungan untuk ' . $nama_pasien . ' telah dihapus.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('kunjungan.index')->with('error', 'Gagal menghapus kunjungan: ' . $e->getMessage());
}
}
public function cetakAntrian($id)
{
$kunjungan = Pemeriksaan::where('id', $id)->get();
return view('pages.cetak_antrian', compact('kunjungan'));
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Http\Controllers;
use App\Models\Pemeriksaan;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class LaporanController extends Controller
{
public function index()
{
$no = 1;
$kunjungan = Pemeriksaan::select(
DB::raw('MONTHNAME(tgl_kunjungan) AS nama_bulan'),
DB::raw('YEAR(tgl_kunjungan) AS tahun'),
DB::raw('MONTH(tgl_kunjungan) AS bulan')
)
->groupBy('nama_bulan', 'tahun', 'bulan')
->get();
return view('pages.laporan-kunjungan', compact('kunjungan', 'no'));
}
public function cetak($bulan, $tahun)
{
$periksa = Pemeriksaan::with('pasien')
->whereMonth('tgl_kunjungan', $bulan)
->whereYear('tgl_kunjungan', $tahun)
->get();
return view('pages.cetakLaporanKunjungan', compact('periksa'));
}
}

View File

@ -0,0 +1,115 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\ObatRequest;
// use App\Http\Controllers\ObatController;
use App\Models\Obat;
class ObatController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$obat = Obat::get();
$jumlah_obat = Obat::count();
return view('pages.obat', compact(
'no',
'obat',
'jumlah_obat'
));
}
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke database
$obat = Obat::create($request->all());
// Cek stok obat
if ($obat->stok <= 5) {
// Jika stok obat tinggal 5 atau kurang, berikan pesan peringatan
return redirect()->route('obat.index')->with('warning', 'Stok obat "' . $obat->nama_obat . '" tinggal ' . $obat->stok . '. Segera restock obat.');
}
\Log::info('Obat berhasil ditambahkan: ' . $obat->nama_obat); // Tambahkan pernyataan log
return redirect()->route('obat.index')->with('success', 'Obat "' . $obat->nama_obat . '" berhasil ditambahkan.');
} catch (\Exception $e) {
\Log::error('Gagal menambahkan obat: ' . $e->getMessage()); // Tambahkan pernyataan log
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('obat.index')->with('error', 'Gagal menambahkan obat: ' . $e->getMessage());
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
$data = Obat::find($id); // Mencari data berdasarkan ID
return view('edit', ['data' => $data]);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
try {
$obat = Obat::findOrFail($id);
$obat->update($request->all());
return redirect()->route('obat.index')->with('success', 'Data obat "' . $obat->nama_obat . '" berhasil diperbarui.');
} catch (\Exception $e) {
return redirect()->route('obat.index')->with('error', 'Gagal memperbarui data obat: ' . $e->getMessage());
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
try {
$data = Obat::findOrFail($id);
$data->delete();
return redirect()->route('obat.index')->with('success', 'Data obat berhasil dihapus.');
} catch (\Exception $e) {
return redirect()->route('obat.index')->with('error', 'Gagal menghapus data obat: ' . $e->getMessage());
}
}
public function addStock(Request $request, string $id)
{
try {
$obat = Obat::findOrFail($id);
$obat->stok += $request->input('jumlah'); // Menambah stok obat
$obat->save(); // Menyimpan perubahan stok ke database
\Log::info('Stok obat berhasil ditambahkan: ' . $obat->nama_obat); // Tambahkan pernyataan log
return redirect()->route('obat.index')->with('success', 'Stok obat "' . $obat->nama_obat . '" berhasil ditambahkan.');
} catch (\Exception $e) {
\Log::error('Gagal menambahkan stok obat: ' . $e->getMessage()); // Tambahkan pernyataan log
return redirect()->route('obat.index')->with('error', 'Gagal menambahkan stok obat: ' . $e->getMessage());
}
}
}

View File

@ -0,0 +1,98 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\obatmasuk;
use App\Models\Obat;
class ObatMasukController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$obatmasuk = obatmasuk::with('obat')->get();
$obat = Obat::get();
$no = 1;
return view('pages.obatmasuk',compact('obatmasuk','obat','no'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
try {
// Simpan data ke database
$obat = obatmasuk::create($request->all());
$obat = Obat::find($request['id_obat']);
// Memperbarui stok obat
if ($obat) {
$obat->stok += $request['jumlah']; // Menambah stok obat
$obat->save(); // Menyimpan perubahan stok ke database
} else {
// Tindakan jika obat tidak ditemukan (opsional)
}
\Log::info('Stok obat berhasil ditambahkan: ' . $obat->nama_obat); // Tambahkan pernyataan log
return redirect()->route('obatmasuk.index')->with('success', 'Stok obat "' . $obat->nama_obat . '" berhasil ditambahkan.');
} catch (\Exception $e) {
\Log::error('Gagal menambahkan stok obat: ' . $e->getMessage()); // Tambahkan pernyataan log
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('obatmasuk.index')->with('error', 'Gagal menambahkan stok obat: ' . $e->getMessage());
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
try {
$data = ObatMasuk::findOrFail($id);
$data->delete();
return redirect()->route('obatmasuk.index')->with('success', 'Obat masuk berhasil dihapus.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('obatmasuk.index')->with('error', 'Gagal menghapus obat masuk: ' . $e->getMessage());
}
}
}

View File

@ -0,0 +1,109 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Pemeriksaan;
use App\Models\User;
use App\Models\Pasien;
use App\Models\Obat;
use App\Models\Resep;
class ObatpasienController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$dokter = User::where('role', 'dokter')
->where('status', 'aktif')->get();
$pasien = Pasien::get();
$periksa = Pemeriksaan::with('pasien')->get();
$resep_obat = Obat::get();
// Mengambil data pemeriksaan dengan mengurutkan berdasarkan waktu pembuatan secara descending
$kunjungan = Resep::select('resepobat.id_periksa', 'pemeriksaan.no_periksa', 'pasien.nama_pasien', 'resepobat.pembelian as pembelian', 'pemeriksaan.status as statuspemeriksaan', 'resepobat.status as statusobat', 'pemeriksaan.tgl_kunjungan', 'pemeriksaan.waktu_kunjungan')
->join('pemeriksaan', 'resepobat.id_periksa', '=', 'pemeriksaan.id')
->join('pasien', 'pemeriksaan.pasien_id', '=', 'pasien.id')
->orderByDesc('pemeriksaan.tgl_kunjungan') // Urutkan berdasarkan tanggal kunjungan secara descending
->orderByDesc('pemeriksaan.waktu_kunjungan') // Urutkan berdasarkan waktu kunjungan secara descending
->groupBy('pemeriksaan.no_periksa', 'resepobat.id_periksa', 'pemeriksaan.pasien_id', 'pemeriksaan.no_periksa', 'pasien.nama_pasien', 'pembelian', 'pemeriksaan.status', 'resepobat.status', 'pemeriksaan.tgl_kunjungan', 'pemeriksaan.waktu_kunjungan')
->where('pembelian', '!=', 'sendiri')
->get();
return view('pages.obatpasien', compact('kunjungan', 'no', 'dokter', 'pasien', 'resep_obat', 'periksa'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
// dd($request['pembelian']);
try{
foreach ($request['id_obat'] as $index => $id_obat) {
$aturanpakai = (string) $request['aturanpakai'][$index];
$deskripsi = $request['deskripsi'][$index];
// Simpan ke database sesuai kebutuhan Anda
Resep::create([
'id_periksa' => $request['id_periksa'],
'pembelian' => $request['pembelian'],
'status' => $request['status'],
'deskripsi' => (string) $deskripsi,
'aturanpakai' => (string) $aturanpakai,
'id_obat' => (string) $id_obat,
]);
}
// Pemeriksa::create($data);
return redirect()->route('obatpasien.index');
}catch(\Exception $e){
dd($e);
}
}
public function update(Request $request, $id)
{
try {
// Temukan resep berdasarkan id_periksa
$resep = Resep::where('id_periksa', $id)->firstOrFail();
// Lakukan pembaruan pada atribut yang diperlukan
$resep->update($request->all());
// Perbarui semua entri dengan id_periksa yang sama jika status adalah 'selesai'
if ($request->status === 'sudah diambil') {
Resep::where('id_periksa', $id)->update(['status' => 'sudah diambil']);
}
// Redirect dengan pesan sukses
return redirect()->route('obatpasien.index')->with('success', 'Resep updated successfully');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('obatpasien.index')->with('error', 'Failed to update resep: ' . $e->getMessage());
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
}

View File

@ -0,0 +1,148 @@
<?php
namespace App\Http\Controllers;
use Carbon\Carbon;
use App\Models\Pasien;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use App\Http\Requests\PasienRequest;
class PasienController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$pasien = Pasien::orderBy('created_at', 'desc')->get(); // Mengambil data pasien dengan urutan berdasarkan waktu pembuatan, dengan yang terbaru di atas
return view('pages.pasien', compact(
'no',
'pasien'
));
}
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
// dd($request['jenis_kelamin']);
try {
// Validasi data
$request->validate([
'no_rmd' => 'required|unique:pasien,no_rmd',
// tambahkan validasi lainnya sesuai kebutuhan
]);
// Simpan data ke database
$user = Pasien::create($request->all());
$no_rmd = $this->generateNoRmd();
// Update nilai noregis di dalam data user
$user->update(['no_rmd' => $no_rmd]);
return redirect()->route('pasien.index')->with('success', 'Data pasien ' . $request->nama_pasien . ' berhasil ditambahkan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('pasien.index')->with('error', 'Gagal menambahkan data pasien: ' . $e->getMessage());
}
}
public function generateNoRmd()
{
$currentYear = date('y'); // Get the last two digits of the current year, e.g., 24 for 2024
$latestRecord = Pasien::where('no_rmd', 'LIKE', $currentYear . '-%')
->orderBy('no_rmd', 'desc')
->first();
if ($latestRecord) {
// Extract the numeric part (after the dash) and increment it
$latestNumber = intval(substr($latestRecord->no_rmd, 3)); // Extracts the sequence part
$newNumber = $latestNumber + 1; // Increment the sequence
} else {
$newNumber = 1; // Start the sequence from 1 if no records are found
}
// Format the new no_rmd with leading zeros
$noRmd = $currentYear . '-' . str_pad($newNumber, 4, '0', STR_PAD_LEFT);
return $noRmd;
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
$data = Pasien::find($id); // Mencari data berdasarkan ID
return view('edit', ['data' => $data]);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
try {
$pasien = Pasien::findOrFail($id); // Mencari data berdasarkan ID
// Validasi input data jika diperlukan
$request->validate([
'no_rmd' => 'required',
'nik' => 'required',
'nama_pasien' => 'required',
'jenis_kelamin' => 'required',
'tempat_lahir' => 'required',
'usia' => 'required',
'agama' => 'required',
'pekerjaan' => 'required',
'alamat' => 'required',
'no_telp' => 'required',
'askes' => 'required',
'statuspasien' => 'nullable',
'no_dana_sehat' => 'nullable',
// Tambahkan validasi untuk kolom lain sesuai kebutuhan
]);
// Simpan perubahan data
$pasien->update($request->all());
return redirect()->route('pasien.index')->with('success', 'Data pasien ' . $pasien->nama_pasien . ' berhasil diperbarui.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('pasien.index')->with('error', 'Gagal memperbarui data pasien: ' . $e->getMessage());
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
try {
$pasien = Pasien::findOrFail($id);
$nama_pasien = $pasien->nama_pasien; // Simpan nama pasien sebelum dihapus
$pasien->delete();
return redirect()->route('pasien.index')->with('success', 'Data pasien ' . $nama_pasien . ' berhasil dihapus.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('pasien.index')->with('error', 'Gagal menghapus data pasien: ' . $e->getMessage());
}
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace App\Http\Controllers;
use App\Models\Resep;
use App\Models\Tindakan;
use App\Models\Pemeriksaan;
use App\Models\Pembayaran;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class PembayaranController extends Controller
{
public function index()
{
$no = 1;
$kunjungan = Pemeriksaan::select('*', 'pemeriksaan.id as id_periksa')
->leftJoin('pasien', 'pasien.id', 'pemeriksaan.pasien_id')
->orderBy('pemeriksaan.created_at', 'desc')
->get();
// Loop melalui setiap item dalam $kunjungan
foreach ($kunjungan as $data) {
$harga = Tindakan::select('harga', 'nama_tindakan')->whereIn('nama_tindakan', $data->tindakan)->get();
$data->total_harga_tindakan = 0;
$hargatindakan = [];
$namatindakan = [];
// $data->hargatindakan = $harga->harga;
foreach ($harga as $item) {
$namatindakan[] = $item->nama_tindakan;
if ($data->askes == "Dana_Sehat") {
if ($item->nama_tindakan == "periksa") {
$hargatindakan[] = 0;
$data->total_harga_tindakan += 0;
} else {
$hargatindakan[] = $item->harga;
$data->total_harga_tindakan += $item->harga;
}
} else {
$hargatindakan[] = $item->harga;
$data->total_harga_tindakan += $item->harga;
}
}
$data->hargatindakan = $hargatindakan;
$data->namatindakan = $namatindakan;
$data->statuspembayaran = Pembayaran::where('id_periksa', $data->id_periksa)->first()->status ?? "belum";
}
return view('pages.pembayaran', compact('kunjungan', 'no'));
}
}

View File

@ -0,0 +1,101 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Pemeriksaan;
use App\Models\User;
use App\Models\Pasien;
use App\Models\Tindakan;
class PemeriksaanController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$dokter = User::where('role','dokter')
->where('status','aktif')->get();
$pasien = Pasien::get();
$tindakan = Tindakan::get();
$kunjungan = Pemeriksaan::with('pasien')->orderBy('created_at', 'desc')->get();
return view('pages.pemeriksaan',compact('kunjungan','no','dokter','pasien','tindakan'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$data = $request->all();
Pemeriksaan::create($data);
return redirect()->route('pemeriksaan.index');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
public function update(Request $request, $id)
{
try {
$pemeriksaan = Pemeriksaan::findOrFail($id);
if ($request->hasFile('foto')) {
$data = $request->all();
$data['foto'] = $request->file('foto')->store('assets/foto_fisik', 'public');
$pemeriksaan->update($data);
// Dapatkan nama pasien yang terkait dengan pemeriksaan
$nama_pasien = $pemeriksaan->pasien->nama_pasien;
// Berikan pesan bahwa foto fisik telah berhasil dimasukkan sesuai dengan nama pasien
return redirect()->route('pemeriksaan.index')->with('success', 'Pasien ' . $nama_pasien . ' telah diperiksa oleh perawat dan berhasil memasukkan foto fisik.');
} else {
$pemeriksaan->update($request->all());
// Dapatkan nama pasien yang terkait dengan pemeriksaan
$nama_pasien = $pemeriksaan->pasien->nama_pasien;
// Berikan pesan bahwa pasien telah diperiksa oleh perawat
return redirect()->route('pemeriksaan.index')->with('success', 'Pasien ' . $nama_pasien . ' telah diperiksa oleh perawat.');
}
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('pemeriksaan.index')->with('error', 'Gagal memperbarui pemeriksaan: ' . $e->getMessage());
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Pemeriksaan::findOrFail($id);
$data->delete();
return redirect()->route('pemeriksaan.index');
}
}

View File

@ -0,0 +1,135 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Pemeriksaan;
use App\Models\User;
use App\Models\Pasien;
use App\Models\Tindakan;
use App\Models\Penyakit;
use App\Models\Obat;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\DB;
class PemeriksaandokterController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$dokter = User::where('role', 'dokter')
->where('status', 'aktif')->get();
$pasien = Pasien::get();
$tindakan = Tindakan::get();
$penyakit = Penyakit::get();
$kunjungan = Pemeriksaan::with('pasien')->orderBy('created_at', 'desc')->get();
$resep_obat = Obat::get();
// print_r($kunjungan[0]); die();
return view('pages.pemeriksaandokter', compact('kunjungan', 'no', 'dokter', 'pasien', 'tindakan', 'penyakit', 'resep_obat'));
}
public function rujukan(Request $request)
{
$no = 1;
App::setLocale('id');
$id_periksa = $request->get('id_periksa');
$tujuan = $request->get('tujuan');
$kunjungan = Pemeriksaan::select('*',
DB::raw('
(
SELECT JSON_ARRAYAGG(
JSON_OBJECT(
"id", resepobat.id,
"nama_obat", (SELECT nama_obat FROM obat WHERE obat.id = resepobat.id_obat),
"deskripsi", resepobat.deskripsi,
"aturanpakai", resepobat.aturanpakai,
"jumlah", resepobat.jumlah
)
)
FROM resepobat
WHERE resepobat.id_periksa = pemeriksaan.id
) as resep
')
)->with('pasien')->find($id_periksa);
// print_r($kunjungan[0]); die();
return view('pages.rujukan', compact('kunjungan', 'no', 'tujuan'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$data = $request->all();
Pemeriksaan::create($data);
return redirect()->route('pemeriksaandokter.index');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
public function update(Request $request, $id)
{
try {
$pemeriksaan = Pemeriksaan::findOrFail($id);
if ($request->hasFile('foto')) {
$data = $request->all();
$data['foto'] = $request->file('foto')->store('assets/foto_fisik', 'public');
$pemeriksaan->update($data);
} else {
$pemeriksaan->update($request->all());
}
// Dapatkan nama pasien yang terkait dengan pemeriksaan
$nama_pasien = $pemeriksaan->pasien->nama_pasien;
// Berikan pesan bahwa pasien telah selesai diperiksa oleh dokter
return redirect()->route('pemeriksaandokter.index')->with('success', 'Pasien ' . $nama_pasien . ' telah selesai diperiksa oleh dokter.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('pemeriksaandokter.index')->with('error', 'Gagal memperbarui pemeriksaan: ' . $e->getMessage());
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Pemeriksaan::findOrFail($id);
$data->delete();
return redirect()->route('pemeriksaandokter.index');
}
}

View File

@ -0,0 +1,98 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\PenyakitRequest;
use App\Http\Controllers\PenyakitController;
use App\Models\Penyakit;
use Maatwebsite\Excel\Facades\Excel;
use Illuminate\Support\Facades\File;
use App\Imports\PenyakitImport;
class PenyakitController extends Controller
{
public function index()
{
$no = 1;
$penyakit = Penyakit::get();
return view('pages.penyakit', compact(
'no',
'penyakit',
));
}
public function store(Request $request)
{
// Validasi file yang diunggah
$request->validate([
'file' => 'required|mimes:csv,xls,xlsx',
]);
// Ambil data dari file yang diunggah
$importedData = Excel::toArray(new PenyakitImport, $request->file('file'));
// Loop melalui data yang diimpor
foreach ($importedData[0] as $data) {
// Validasi bahwa 'kode' tidak null atau kosong
if (isset($data['kode']) && !empty($data['kode'])) {
// Simpan data dengan ID kecamatan yang cocok
// Mencari penyakit berdasarkan kode atau nama_penyakit
$existingPenyakit = Penyakit::where('kode', $data['kode'])
->orWhere('nama_penyakit', $data['nama_penyakit'])
->first();
if (!$existingPenyakit) {
// Jika tidak ditemukan, buat entri baru
Penyakit::create([
'kode' => $data['kode'],
'nama_penyakit' => $data['nama_penyakit'],
]);
}
} else {
\Log::warning('Data entry skipped due to missing kode:', $data);
}
}
return redirect()->back()->with('success', 'File Excel berhasil diunggah dan data berhasil diimpor.');
}
public function update(Request $request, string $id)
{
try {
$data = Penyakit::find($id); // Mencari data berdasarkan ID
// Validasi input data jika diperlukan
$request->validate([
'kode' => 'required',
'nama_penyakit' => 'required',
// Tambahkan validasi untuk kolom lain sesuai kebutuhan
]);
// Simpan perubahan data
$data->kode = $request->input('kode');
$data->nama_penyakit = $request->input('nama_penyakit');
// Setel nilai kolom lain sesuai kebutuhan
$data->save();
return redirect()->route('penyakit.index')->with('success', 'Data penyakit "' . $data->nama_penyakit . '" berhasil diperbarui.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('penyakit.index')->with('error', 'Gagal memperbarui penyakit: ' . $e->getMessage());
}
}
public function destroy(string $id)
{
try {
$data = Penyakit::findOrFail($id);
$data->delete();
return redirect()->route('penyakit.index')->with('success', 'Data penyakit berhasil dihapus.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('penyakit.index')->with('error', 'Gagal menghapus data penyakit: ' . $e->getMessage());
}
}
}

View File

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

View File

@ -0,0 +1,83 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Pemeriksaan;
use App\Models\User;
use App\Models\Pasien;
class RekammedisController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$dokter = User::where('role','dokter')
->where('status','aktif')->get();
$pasien = Pasien::whereRaw('(SELECT count(*) FROM pemeriksaan WHERE pemeriksaan.pasien_id = pasien.id) > 0')->orderBy('no_rmd', 'DESC')->get();
// Ambil data kunjungan dengan urutan berdasarkan waktu pembuatan, dimulai dari yang terbaru
$kunjungan = Pemeriksaan::select('pemeriksaan.*', 'pasien.no_rmd', 'pasien.nama_pasien')
->leftJoin('pasien', 'pemeriksaan.pasien_id', '=', 'pasien.id')
->orderBy('pemeriksaan.created_at', 'desc') // atau kolom lain yang menunjukkan waktu terbaru
->distinct('pasien.no_rmd')
->get();
return view('pages.rekammedis',compact('kunjungan','no','dokter','pasien'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$data = $request->all();
Pemeriksaan::create($data);
return redirect()->route('rekammedis.index');
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
public function update(Request $request, $id)
{
$user = Pemeriksaan::findOrFail($id);
$user->update($request->all());
return redirect()->route('rekammedis.index')->with('success', 'User updated successfully');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Pemeriksaan::findOrFail($id);
$data->delete();
return redirect()->route('rekammedis.index');
}
}

View File

@ -0,0 +1,139 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Pemeriksaan;
use App\Models\User;
use App\Models\Pasien;
use App\Models\Obat;
use App\Models\Resep;
class ResepobatController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$dokter = User::where('role', 'dokter')
->where('status', 'aktif')->get();
$pasien = Pasien::get();
$periksa = Pemeriksaan::with('pasien')->get();
$resep_obat = Obat::get();
// Mengambil data pemeriksaan dengan mengurutkan berdasarkan waktu pembuatan secara descending
$kunjungan = Pemeriksaan::with('pasien')->orderBy('created_at', 'desc')->get();
// print_r($kunjungan[0]->pasien); die();
return view('pages.resepobat', compact('kunjungan', 'no', 'dokter', 'pasien', 'resep_obat', 'periksa'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
// var_dump($request); die();
try {
foreach ($request['id_obat'] as $index => $id_obat) {
$aturanpakai = (string) $request['aturanpakai'][$index];
$deskripsi = $request['deskripsi'][$index];
$jumlah = $request['jumlah'][$index];
if($request['pembelian'] == 'sendiri')
$status = 'sudah diambil';
else
$status = $request['status'];
// Simpan ke database resep
Resep::create([
'id_periksa' => $request['id_periksa'],
'pembelian' => $request['pembelian'],
'status' => $status,
'deskripsi' => (string) $deskripsi,
'jumlah' => (string) $jumlah,
'aturanpakai' => (string) $aturanpakai,
'id_obat' => (string) $id_obat,
]);
// Kurangi stok obat di table obat jika pembelian bukan 'sendiri'
if($request['pembelian'] != 'sendiri') {
// Kurangi stok obat di table obat
$obat = Obat::find($id_obat); // Cari obat berdasarkan id_obat
if ($obat) {
// Pastikan jumlah yang diinputkan tidak melebihi stok yang tersedia
if ($obat->stok >= $jumlah) {
// Kurangi stok obat sebanyak jumlah yang diinputkan
$obat->stok -= $jumlah;
// Simpan perubahan stok ke database
$obat->save();
} else {
// Handle jika jumlah yang diinputkan melebihi stok yang tersedia
// Misalnya: throw new Exception("Stok obat tidak mencukupi untuk jumlah yang diminta");
}
} else {
// Handle jika obat tidak ditemukan (opsional)
// Misalnya: throw new Exception("Obat dengan ID $id_obat tidak ditemukan");
}
}
}
return redirect()->route('resepobat.index');
} catch (\Exception $e) {
dd($e);
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
public function update(Request $request, $id)
{
$user = Pemeriksaan::findOrFail($id);
$user->update($request->all());
return redirect()->route('resepobat.index')->with('success', 'User updated successfully');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
$datas = Resep::where('id_periksa', $id)->get(); // Menggunakan where untuk mencari semua data berdasarkan ID periksa
foreach ($datas as $data) {
// Mengembalikan stok obat sebelum menghapus data resep
$obat = Obat::find($data->id_obat);
if ($obat) {
$obat->stok += $data->jumlah; // Menambahkan kembali jumlah obat yang dihapus dari resep
$obat->save();
}
$data->delete(); // Menghapus data resep satu per satu
}
return redirect()->route('resepobat.index');
}
}

View File

@ -0,0 +1,98 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\SupplierRequest;
use App\Http\Controllers\SupplierController;
use App\Models\Supplier;
class SupplierController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$supplier = Supplier::get();
return view('pages.supplier', compact(
'no',
'supplier'
));
}
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(SupplierRequest $request)
{
try {
// Simpan data ke database
Supplier::create($request->all());
return redirect()->route('supplier.index')->with('success', 'Data berhasil disimpan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('supplier.index')->with('error', 'Gagal menyimpan data: ' . $e->getMessage());
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
$data = Supplier::find($id); // Mencari data berdasarkan ID
return view('edit', ['data' => $data]);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
$data = Supplier::find($id); // Mencari data berdasarkan ID
// Validasi input data jika diperlukan
$request->validate([
'nama_supplier' => 'required',
'alamat' => 'required',
'no_telp' => 'required',
// Tambahkan validasi untuk kolom lain sesuai kebutuhan
]);
// Simpan perubahan data
$data->nama_supplier = $request->input('nama_supplier');
$data->alamat = $request->input('alamat');
$data->no_telp = $request->input('no_telp');
// Setel nilai kolom lain sesuai kebutuhan
$data->save();
return redirect()->route('supplier.index')->with('success', 'Data berhasil diperbarui.');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
$data = Supplier::findOrFail($id);
$data->delete();
return redirect()->route('supplier.index');
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\TindakanRequest;
use App\Http\Controllers\TindakanController;
use App\Models\Tindakan;
class TindakanController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$tindakan = Tindakan::get();
return view('pages.tindakan', compact(
'no',
'tindakan'
));
}
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(TindakanRequest $request)
{
try {
// Simpan data ke database
Tindakan::create($request->all());
return redirect()->route('tindakan.index')->with('success', 'Tindakan berhasil ditambahkan.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('tindakan.index')->with('error', 'Gagal menambahkan tindakan: ' . $e->getMessage());
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
$data = Tindakan::find($id); // Mencari data berdasarkan ID
return view('edit', ['data' => $data]);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
try {
$data = Tindakan::find($id); // Mencari data berdasarkan ID
// Validasi input data jika diperlukan
$request->validate([
'nama_tindakan' => 'required',
'harga' => 'required',
// Tambahkan validasi untuk kolom lain sesuai kebutuhan
]);
// Simpan perubahan data
$data->nama_tindakan = $request->input('nama_tindakan');
$data->harga = $request->input('harga');
// Setel nilai kolom lain sesuai kebutuhan
$data->save();
return redirect()->route('tindakan.index')->with('success', 'Data tindakan "' . $data->nama_tindakan . '" berhasil diperbarui.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('tindakan.index')->with('error', 'Gagal memperbarui tindakan: ' . $e->getMessage());
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
try {
$data = Tindakan::findOrFail($id);
$data->delete();
return redirect()->route('tindakan.index')->with('success', 'Tindakan berhasil dihapus.');
} catch (\Exception $e) {
// Tangkap pengecualian dan tampilkan pesan kesalahan
return redirect()->route('tindakan.index')->with('error', 'Gagal menghapus tindakan: ' . $e->getMessage());
}
}
}

View File

@ -0,0 +1,103 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use App\Http\Requests\UserRequest;
use Illuminate\Support\Facades\Hash;
use Yajra\DataTables\Facades\DataTables;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$no = 1;
$user = User::get();
return view('pages.user', compact(
'user',
'no'
));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(UserRequest $request)
{
try {
$data = $request->all();
$data['password'] = Hash::make($data['password']);
User::create($data);
return redirect()->route('user.index')->with('success', 'Pengguna "' . $request->name . '" berhasil ditambahkan.');
} catch (\Exception $e) {
return redirect()->route('user.index')->with('error', 'Gagal menambahkan pengguna: ' . $e->getMessage());
}
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
try {
$user = User::findOrFail($id);
$request->validate([
'email' => 'required|email',
'name' => 'required',
'password' => 'required',
'role' => 'required',
]);
$user->update($request->all());
return redirect()->route('user.index')->with('success', 'Pengguna "' . $user->name . '" berhasil diperbarui.');
} catch (\Exception $e) {
return redirect()->route('user.index')->with('error', 'Gagal memperbarui pengguna: ' . $e->getMessage());
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
try {
$user = User::findOrFail($id);
$user->delete();
return redirect()->route('user.index')->with('success', 'Pengguna "' . $user->name . '" berhasil dihapus.');
} catch (\Exception $e) {
return redirect()->route('user.index')->with('error', 'Gagal menghapus pengguna: ' . $e->getMessage());
}
}
}

View File

@ -0,0 +1,123 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Pemeriksaan;
use Illuminate\Support\Facades\DB;
class rekapkesakitanController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$listbulan = [
'1' => 'Januari',
'2' => 'Februari',
'3' => 'Maret',
'4' => 'April',
'5' => 'Mei',
'6' => 'Juni',
'7' => 'Juli',
'8' => 'Agustus',
'9' => 'September',
'10' => 'Oktober',
'11' => 'November',
'12' => 'Desember'
];
// $namaobat = $request->input('obat_id');
$bulan = $request->input('bulan');
$tahun = $request->input('tahun');
$no = 1;
$query = Pemeriksaan::select(
'diagnosa',
DB::raw('count(*) as total'),
DB::raw('SUM(CASE WHEN pasien.jenis_kelamin = "P" THEN 1 ELSE 0 END) as wanita'),
DB::raw('SUM(CASE WHEN pasien.jenis_kelamin = "L" THEN 1 ELSE 0 END) as pria'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 0 AND 5 THEN 1 ELSE 0 END) as balita'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 6 AND 11 THEN 1 ELSE 0 END) as anak'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 12 AND 16 THEN 1 ELSE 0 END) as remaja_awal'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 17 AND 25 THEN 1 ELSE 0 END) as remaja_akhir'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 26 AND 35 THEN 1 ELSE 0 END) as dewasa_awal'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 36 AND 45 THEN 1 ELSE 0 END) as dewasa_akhir'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 46 AND 55 THEN 1 ELSE 0 END) as lansia_awal'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 56 AND 65 THEN 1 ELSE 0 END) as lansia_akhir'),
DB::raw('SUM(CASE WHEN pasien.usia > 65 THEN 1 ELSE 0 END) as manula')
)
->leftJoin('pasien', 'pemeriksaan.pasien_id', '=', 'pasien.id')
->groupBy('diagnosa');
if ($bulan) {
$query->whereMonth('tgl_kunjungan', $bulan);
}
if ($tahun) {
$query->whereYear('tgl_kunjungan', $tahun);
}
$periksa = $query->get();
$total = $query->count();
return view('pages.rekapkesakitan', compact('no', 'listbulan','periksa','total'));
}
public function cetakrekapsakit(Request $request)
{
$listbulan = [
'1' => 'Januari',
'2' => 'Februari',
'3' => 'Maret',
'4' => 'April',
'5' => 'Mei',
'6' => 'Juni',
'7' => 'Juli',
'8' => 'Agustus',
'9' => 'September',
'10' => 'Oktober',
'11' => 'November',
'12' => 'Desember'];
// $namaobat = $request->input('obat_id');
$bulan = $request->input('bulan');
$tahun = $request->input('tahun');
$no = 1;
$query = Pemeriksaan::select(
'diagnosa',
DB::raw('count(*) as total'),
DB::raw('SUM(CASE WHEN pasien.jenis_kelamin = "P" THEN 1 ELSE 0 END) as wanita'),
DB::raw('SUM(CASE WHEN pasien.jenis_kelamin = "L" THEN 1 ELSE 0 END) as pria'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 0 AND 5 THEN 1 ELSE 0 END) as balita'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 6 AND 11 THEN 1 ELSE 0 END) as anak'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 12 AND 16 THEN 1 ELSE 0 END) as remaja_awal'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 17 AND 25 THEN 1 ELSE 0 END) as remaja_akhir'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 26 AND 35 THEN 1 ELSE 0 END) as dewasa_awal'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 36 AND 45 THEN 1 ELSE 0 END) as dewasa_akhir'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 46 AND 55 THEN 1 ELSE 0 END) as lansia_awal'),
DB::raw('SUM(CASE WHEN pasien.usia BETWEEN 56 AND 65 THEN 1 ELSE 0 END) as lansia_akhir'),
DB::raw('SUM(CASE WHEN pasien.usia > 65 THEN 1 ELSE 0 END) as manula')
)
->leftJoin('pasien', 'pemeriksaan.pasien_id', '=', 'pasien.id')
->groupBy('diagnosa');
if ($bulan) {
$query->whereMonth('tgl_kunjungan', $bulan);
}
if ($tahun) {
$query->whereYear('tgl_kunjungan', $tahun);
}
$periksa = $query->get();
$total = $query->count();
return view('pages.cetakrekapsakit', compact('no', 'listbulan','periksa','total'));
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Resep;
use App\Models\Obat;
class rekapobatController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$listbulan = [
'1' => 'Januari',
'2' => 'Februari',
'3' => 'Maret',
'4' => 'April',
'5' => 'Mei',
'6' => 'Juni',
'7' => 'Juli',
'8' => 'Agustus',
'9' => 'September',
'10' => 'Oktober',
'11' => 'November',
'12' => 'Desember'];
$namaobat = $request->input('obat_id','obat.satuan');
$bulan = $request->input('bulan');
$tahun = $request->input('tahun');
$no = 1;
$nameobat = Obat::get();
$query = Resep::select('obat.nama_obat', 'obat.satuan', \DB::raw('count(*) as totalobat'), \DB::raw('sum(jumlah) as totalterjual'))
->join('obat', 'resepobat.id_obat', '=', 'obat.id')
->where('pembelian', 'apotek')
->groupBy('id_obat', 'obat.satuan');
if ($bulan) {
$query->whereMonth('resepobat.created_at', $bulan);
}
if ($tahun) {
$query->whereYear('resepobat.created_at', $tahun);
}
$Obat = $query->get();
$totalobat = $query->select('jumlah')->count();
return view('pages.rekapobat', compact('no', 'Obat', 'listbulan','nameobat','totalobat'));
}
public function cetakrekapobat(Request $request)
{
$listbulan = [
'1' => 'Januari',
'2' => 'Februari',
'3' => 'Maret',
'4' => 'April',
'5' => 'Mei',
'6' => 'Juni',
'7' => 'Juli',
'8' => 'Agustus',
'9' => 'September',
'10' => 'Oktober',
'11' => 'November',
'12' => 'Desember'];
$namaobat = $request->input('obat_id','obat.satuan');
$bulan = $request->input('bulan');
$tahun = $request->input('tahun');
$no = 1;
$nameobat = Obat::get();
$query = Resep::select('obat.nama_obat','obat.satuan', \DB::raw('count(*) as totalobat'), \DB::raw('sum(jumlah) as totalterjual'))
->join('obat', 'resepobat.id_obat', '=', 'obat.id')
->where('pembelian', 'apotek')
->groupBy('id_obat', 'obat.satuan');
if ($bulan) {
$query->whereMonth('resepobat.created_at', $bulan);
}
if ($tahun) {
$query->whereYear('resepobat.created_at', $tahun);
}
$Obat = $query->get();
$totalobat = $query->select('jumlah')->count();
return view('pages.cetakrekapobat', compact('no', 'Obat', 'listbulan','nameobat','totalobat'));
}
}

View File

@ -0,0 +1,163 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Resep;
use App\Models\Obat;
use App\Models\Pasien;
use App\Models\Pemeriksaan;
use App\Models\Tindakan;
class rekaptindakanController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$tindakan = $request->input('tindakan');
$bulan = $request->input('bulan');
$tahun = $request->input('tahun');
$listbulan = [
'1' => 'Januari',
'2' => 'Februari',
'3' => 'Maret',
'4' => 'April',
'5' => 'Mei',
'6' => 'Juni',
'7' => 'Juli',
'8' => 'Agustus',
'9' => 'September',
'10' => 'Oktober',
'11' => 'November',
'12' => 'Desember'
];
$no = 1;
$pasien = Pasien::get();
$periksa = Pemeriksaan::with('pasien')->get();
$resep_obat = Obat::get();
$datatindakan = Tindakan::get();
// Mengambil data pemeriksaan dengan mengurutkan berdasarkan waktu pembuatan secara descending
$query = Pemeriksaan::with('pasien')->orderBy('created_at', 'desc');
if ($tindakan) {
$query->whereJsonContains('tindakan', [$tindakan]);
}
if ($bulan) {
$query->whereMonth('tgl_kunjungan', $bulan);
}
if ($tahun) {
$query->whereYear('tgl_kunjungan', $tahun);
}
$kunjungan = $query->get();
foreach ($kunjungan as $data) {
$hargatindakan = [];
if ($data->tindakan && is_array($data->tindakan)) {
foreach ($data->tindakan as $nama_tindakan) {
$item = Tindakan::where('nama_tindakan', $nama_tindakan)->first();
if ($item) {
if ($data->pasien->askes == "Dana_Sehat" && ($nama_tindakan == "periksa" || $nama_tindakan == "pemeriksaan dan konsultasi")) {
$hargatindakan[$nama_tindakan] = 0;
} else {
$hargatindakan[$nama_tindakan] = $item->harga;
}
}
}
}
$data->hargatindakan = $hargatindakan;
}
return view('pages.rekaptindakan', compact('kunjungan', 'no', 'pasien', 'resep_obat', 'periksa', 'datatindakan', 'listbulan'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function cetakrekaptindakan(Request $request)
{
$tindakan = $request->input('tindakan');
$bulan = $request->input('bulan');
$tahun = $request->input('tahun');
$listbulan = [
'1' => 'Januari',
'2' => 'Februari',
'3' => 'Maret',
'4' => 'April',
'5' => 'Mei',
'6' => 'Juni',
'7' => 'Juli',
'8' => 'Agustus',
'9' => 'September',
'10' => 'Oktober',
'11' => 'November',
'12' => 'Desember'];
$no = 1;
$pasien = Pasien::get();
$periksa = Pemeriksaan::with('pasien')->get();
$resep_obat = Obat::get();
$datatindakan = Tindakan::get();
// Mengambil data pemeriksaan dengan mengurutkan berdasarkan waktu pembuatan secara descending
$query = Pemeriksaan::with('pasien')->orderBy('created_at', 'desc');
if ($tindakan) {
// $query->whereJsonContains('tindakan', ['infus']);
$query->whereJsonContains('tindakan', [$tindakan]);
}
if ($bulan) {
$query->whereMonth('tgl_kunjungan', $bulan);
}
if ($tahun) {
$query->whereYear('tgl_kunjungan', $tahun);
}
$kunjungan = $query->get();
foreach ($kunjungan as $data) {
$hargatindakan = [];
if ($data->tindakan && is_array($data->tindakan)) {
foreach ($data->tindakan as $nama_tindakan) {
$item = Tindakan::where('nama_tindakan', $nama_tindakan)->first();
if ($item) {
if ($data->pasien->askes == "Dana_Sehat" && ($nama_tindakan == "periksa" || $nama_tindakan == "pemeriksaan dan konsultasi")) {
$hargatindakan[$nama_tindakan] = 0;
} else {
$hargatindakan[$nama_tindakan] = $item->harga;
}
}
}
}
$data->hargatindakan = $hargatindakan;
}
return view('pages.cetakrekaptindakan', compact('kunjungan', 'no', 'pasien', 'resep_obat', 'periksa', 'datatindakan', 'listbulan'));
}
}

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'email' => 'required|string|unique:users',
'name' => 'required|string',
'password' => 'required|min:8',
'role' => 'required|string',
];
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Imports;
use App\Models\Penyakit;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
class PenyakitImport implements ToModel, WithHeadingRow
{
public function model(array $row)
{
return new Penyakit([
'kode' => $row['kode'],
'nama_penyakit' => $row['nama_penyakit']
]);
}
}

19
app/Models/Obat.php Normal file
View File

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Obat extends Model
{
protected $table = 'obat';
protected $fillable =
[
'nama_obat',
'kode_obat',
'stok',
'harga',
'satuan',
];
}

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

@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Pasien extends Model
{
protected $table = 'pasien';
protected $fillable =
[
'no_rmd',
'nik',
'nama_pasien',
'jenis_kelamin',
'tempat_lahir',
'tanggal_lahir',
'usia',
'agama',
'pekerjaan',
'alamat',
'no_telp',
'askes',
'noregis',
'statuspasien',
'no_dana_sehat'
];
public function resep()
{
return $this->hasmany(Resep::class, 'id','id_pasien');
}
}

22
app/Models/Pembayaran.php Normal file
View File

@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Pembayaran extends Model
{
use HasFactory;
protected $table = 'pembayaran';
protected $fillable =
[
'id_periksa',
'total',
'status',
];
public function periksa()
{
return $this->belongsTo(Pemeriksaan::class, 'id_periksa', 'id');
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Pemeriksaan extends Model
{
use HasFactory;
protected $table = 'pemeriksaan';
protected $casts = [
'tindakan' => 'array',];
protected $fillable =
[
'user_id',
'pasien_id',
'tgl_kunjungan',
'waktu_kunjungan',
'no_periksa',
'no_antrian',
'keluhan',
'tb',
'td',
'bb',
'nadi',
'spo2',
'pernapasan',
'periksalain',
'alergi',
'diagnosa',
'suhutubuh',
'tindakan',
'keterangan_dokter',
'diameter',
'jumlah',
'posisi',
'foto',
'keterangan',
'status'
];
public function user()
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
public function resep()
{
return $this->hasmany(Resep::class, 'id', 'id_periksa');
}
public function pasien()
{
return $this->belongsTo(Pasien::class, 'pasien_id', 'id');
}
public function harga(){
return $this -> belongsTo(Tindakan::class, "id", "nama_tindakan");
}
}

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

@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Penyakit extends Model
{
protected $table = 'data_penyakit';
protected $fillable =
[
'id',
'kode',
'nama_penyakit',
];
}

36
app/Models/Resep.php Normal file
View File

@ -0,0 +1,36 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Resep extends Model
{
use HasFactory;
protected $table = 'resepobat';
protected $fillable =
[
'id_obat',
'id_pasien',
'id_periksa',
'pembelian',
'deskripsi',
'aturanpakai',
'jumlah',
'status',
'created_at'
];
public function periksa()
{
return $this->belongsTo(Pemeriksaan::class, 'id_periksa','id');
}
public function obat()
{
return $this->belongsTo(Obat::class, 'id_obat','id');
}
public function pasien()
{
return $this->belongsTo(Pasien::class, 'id_pasien','id');
}
}

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

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

16
app/Models/Tindakan.php Normal file
View File

@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Tindakan extends Model
{
protected $table = 'tindakan';
protected $fillable =
[
'nama_tindakan',
'harga'
];
}

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

@ -0,0 +1,50 @@
<?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',
'tlp',
'alamat',
'nip',
'password',
'status',
'role',
];
/**
* 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',
'password' => 'hashed',
];
}

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

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class obatmasuk extends Model
{
use HasFactory;
protected $table = 'obatmasuk';
protected $fillable =
[
'id_obat',
'jumlah',
'created_at',
];
public function obat()
{
return $this->belongsTo(Obat::class, 'id_obat','id');
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

55
bootstrap/app.php Normal file
View File

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

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

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

190
config/app.php Normal file
View File

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

115
config/auth.php Normal file
View File

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

71
config/broadcasting.php Normal file
View File

@ -0,0 +1,71 @@
<?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'),
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];

111
config/cache.php Normal file
View File

@ -0,0 +1,111 @@
<?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'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
'lock_connection' => 'default',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
| stores there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
];

34
config/cors.php Normal file
View File

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

151
config/database.php Normal file
View File

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

379
config/excel.php Normal file
View File

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

76
config/filesystems.php Normal file
View File

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

52
config/hashing.php Normal file
View File

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

131
config/logging.php Normal file
View File

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

125
config/mail.php Normal file
View File

@ -0,0 +1,125 @@
<?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", "ses-v2",
| "postmark", "log", "array", "failover"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
// 'client' => [
// 'timeout' => 5,
// ],
],
'postmark' => [
'transport' => 'postmark',
// 'client' => [
// 'timeout' => 5,
// ],
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];

109
config/queue.php Normal file
View File

@ -0,0 +1,109 @@
<?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,
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];

67
config/sanctum.php Normal file
View File

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

34
config/services.php Normal file
View File

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

201
config/session.php Normal file
View File

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

36
config/view.php Normal file
View File

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

1
database/.gitignore vendored Normal file
View File

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

View File

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

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->string('tlp')->nullable();
$table->string('nip')->nullable();
$table->string('alamat')->nullable();
$table->enum('status', ['aktif', 'tidak'])->default('aktif');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable()->default(null);
$table->string('password');
$table->enum('role', ['admin', 'perawat', 'dokter', 'apoteker']);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};

View File

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

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @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');
}
};

View File

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

View File

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

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('pasien', function (Blueprint $table) {
$table->id()->autoIncrement();
$table->string('no_rmd')->unique();
$table->string('nik');
$table->string('nama_pasien');
$table->enum('jenis_kelamin', ['L', 'P']);
$table->string('tempat_lahir');
$table->date('tanggal_lahir');
$table->string('usia');
$table->string('agama');
$table->string('pekerjaan')->nullable();
$table->string('alamat');
$table->string('no_telp');
$table->enum('biaya', ['Umum', 'Dana_Sehat']);
$table->string('no_dana_sehat')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('pasien');
}
};

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('obat', function (Blueprint $table) {
$table->id()->autoIncrement();
$table->string('kode_obat');
$table->string('nama_obat');
$table->string('stok');
$table->string('harga');
$table->enum('satuan',['tablet', 'kapsul', 'kaplet', 'pil', 'puyer','sirup','botol']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('obat');
}
};

View File

@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('pemeriksaan', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->unsignedBigInteger('pasien_id');
$table->foreign('pasien_id')->references('id')->on('pasien')->onDelete('cascade');
$table->date('tgl_kunjungan')->nullable();
$table->time('waktu_kunjungan')->nullable();
$table->enum('status',['0','1','2'])->nullable();
$table->string('no_periksa')->nullable();
$table->string('keluhan')->nullable();
$table->string('tb')->nullable();
$table->string('td')->nullable();
$table->string('bb')->nullable();
$table->string('nadi')->nullable();
$table->string('spo2')->nullable();
$table->string('pernapasan')->nullable();
$table->string('periksalain')->nullable();
$table->string('alergi')->nullable();
$table->string('diagnosa')->nullable();
$table->string('tindakan')->nullable();
$table->string('keterangan_dokter')->nullable();
$table->string('diameter')->nullable();
$table->string('jumlah')->nullable();
$table->string('posisi')->nullable();
$table->string('foto')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('pemeriksaan');
}
};

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('pembayaran', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('id_periksa');
$table->foreign('id_periksa')->references('id')->on('pemeriksaan')->onDelete('cascade');
$table->string('total');
$table->enum('status', ['sudah bayar', 'belum']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('pembayaran');
}
};

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('resepobat', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('id_obat');
$table->foreign('id_obat')->references('id')->on('obat')->onDelete('cascade');
$table->unsignedBigInteger('id_pasien');
$table->foreign('id_pasien')->references('id')->on('pasien')->onDelete('cascade');
$table->unsignedBigInteger('id_periksa');
$table->foreign('id_periksa')->references('id')->on('pemeriksaan')->onDelete('cascade');
$table->enum('pembelian',['sendiri', 'apotek']);
$table->enum('status',['sudah diambil', 'belum']);
$table->string('deskripsi');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('resepobat');
}
};

View File

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

View File

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

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('resepobat', function (Blueprint $table) {
$table->string('aturanpakai');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('resepobat', function (Blueprint $table) {
$table->string('aturanpakai');
});
}
};

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('resepobat', function (Blueprint $table) {
$table->dropForeign(['id_pasien']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('resepobat', function (Blueprint $table) {
$table->foreign('id_pasien')->references('id')->on('pasien');
});
}
};

View File

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

View File

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

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