First Commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\VwSkppHst;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class SkppHstExport implements FromQuery, WithMapping, WithHeadings
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
public function __construct(int $skppId)
|
||||
{
|
||||
$this->skpp_id = $skppId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function query()
|
||||
{
|
||||
return VwSkppHst::query()->where("tx_skpp_id", $this->skpp_id);
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'B' => NumberFormat::FORMAT_TEXT,
|
||||
];
|
||||
}
|
||||
|
||||
public function map($skpp_hst): array
|
||||
{
|
||||
return [
|
||||
$skpp_hst->no_skpp,
|
||||
"'".$skpp_hst->nip,
|
||||
$skpp_hst->nrk,
|
||||
$skpp_hst->nama,
|
||||
$skpp_hst->nama_golongan,
|
||||
$skpp_hst->status_pegawai,
|
||||
$skpp_hst->tugas,
|
||||
$skpp_hst->dinas,
|
||||
$skpp_hst->tgl_akhir,
|
||||
$skpp_hst->nama_hak,
|
||||
$skpp_hst->nama_keputusan,
|
||||
$skpp_hst->no_pen,
|
||||
$skpp_hst->tgl_pen,
|
||||
$skpp_hst->tgl_tmt,
|
||||
$skpp_hst->ga_pok,
|
||||
$skpp_hst->t_issum,
|
||||
$skpp_hst->t_anak,
|
||||
$skpp_hst->t_lain,
|
||||
$skpp_hst->t_jab,
|
||||
$skpp_hst->t_beras,
|
||||
$skpp_hst->tpph,
|
||||
$skpp_hst->bulat,
|
||||
$skpp_hst->p_beras,
|
||||
$skpp_hst->iuran,
|
||||
$skpp_hst->ppph,
|
||||
$skpp_hst->lain_2,
|
||||
$skpp_hst->nama_kantor,
|
||||
$skpp_hst->wilayah_kantor,
|
||||
$skpp_hst->tgl_cetak,
|
||||
$skpp_hst->keterangan,
|
||||
$skpp_hst->nama_kantor1,
|
||||
$skpp_hst->nama_kantor2,
|
||||
$skpp_hst->wilayah,
|
||||
$skpp_hst->revisi_remarks,
|
||||
date("Y-m-d",strtotime($skpp_hst->created_at)),
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
"No SKPP",
|
||||
"NIP",
|
||||
"NRK",
|
||||
"Nama",
|
||||
"Golongan",
|
||||
"Status Pegawai",
|
||||
"Tugas",
|
||||
"Dinas",
|
||||
"Tgl akhir",
|
||||
"Hak",
|
||||
"Keputusan",
|
||||
"No Keputusan",
|
||||
"Tgl Keputusan",
|
||||
"Tgl TMT",
|
||||
"Gaji Pokok",
|
||||
"Tunjangan Suami Istri",
|
||||
"Tunjangan Anak",
|
||||
"Tunjangan Lain",
|
||||
"Tunjangan Jabatan",
|
||||
"Tunjangan Beras",
|
||||
"Tunjangan PPH",
|
||||
"Pembulatan",
|
||||
"Potongan Beras",
|
||||
"Iuran",
|
||||
"Potongan PPH",
|
||||
"lain - Lain",
|
||||
"Kantor",
|
||||
"Wilayah",
|
||||
"Tgl Cetak",
|
||||
"Pindah Tugas Kantor 1",
|
||||
"Pindah Tugas Kantor 2",
|
||||
"Pindah Tugas Wilayah",
|
||||
"Keterangan",
|
||||
"revisi_remarks",
|
||||
"Tgl Dibuat",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MstGolongan;
|
||||
use Illuminate\Http\Request;
|
||||
use Config;
|
||||
|
||||
class MstGolonganController extends Controller
|
||||
{
|
||||
public function __construct(Request $request){
|
||||
$this->siteTitle = "Data Golongan";
|
||||
parent::__construct();
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data = MstGolongan::latest()->paginate(10);
|
||||
|
||||
return view('admin.mst_golongan.index',compact('data'))
|
||||
->with('i', (request()->input('page', 1) - 1) * 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$this->setSubtitle("Tambah Data");
|
||||
return view('admin.mst_golongan.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'nama_golongan' => 'required',
|
||||
'nama_pangkat' => 'required',
|
||||
'golongan_besar' => 'required',
|
||||
'alias' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
MstGolongan::create($requestAll);
|
||||
|
||||
return redirect()->route('mst-golongan.index')
|
||||
->with('success','Post created successfully.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\MstGolongan $MstGolongan
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(MstGolongan $MstGolongan)
|
||||
{
|
||||
$this->setSubtitle("Detail Data");
|
||||
return view('admin.mst_golongan.show',compact('MstGolongan'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\MstGolongan $MstGolongan
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(MstGolongan $MstGolongan)
|
||||
{
|
||||
$this->setSubtitle("Ubah Data");
|
||||
return view('admin.mst_golongan.edit',compact('MstGolongan'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\MstGolongan $MstGolongan
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, MstGolongan $MstGolongan)
|
||||
{
|
||||
$request->validate([
|
||||
'nama_golongan' => 'required',
|
||||
'nama_pangkat' => 'required',
|
||||
'golongan_besar' => 'required',
|
||||
'alias' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$MstGolongan->update($requestAll);
|
||||
|
||||
return redirect()->route('mst-golongan.index')
|
||||
->with('success','Golongan berhasil diubah!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\MstGolongan $MstGolongan
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(MstGolongan $MstGolongan)
|
||||
{
|
||||
$MstGolongan->delete();
|
||||
|
||||
return redirect()->route('mst-golongan.index')
|
||||
->with('success','Golongan berhasil dihapus!');
|
||||
}
|
||||
|
||||
public function golonganList()
|
||||
{
|
||||
$mstGolongan = MstGolongan::select(["id","nama_golongan","nama_pangkat","alias"])->get();
|
||||
return response()->json($mstGolongan);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MstHak;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MstHakController extends Controller
|
||||
{
|
||||
public function __construct(){
|
||||
$this->siteTitle = "Data Hak";
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = MstHak::latest()->paginate(10);
|
||||
|
||||
return view('admin.mst_hak.index',compact('data'))
|
||||
->with('i', (request()->input('page', 1) - 1) * 10);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->setSubtitle("Tambah Data");
|
||||
return view('admin.mst_hak.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'nama_hak' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
MstHak::create($requestAll);
|
||||
|
||||
return redirect()->route('mst-hak.index')
|
||||
->with('success','Hak berhasil dibuat.');
|
||||
}
|
||||
|
||||
public function show(MstHak $MstHak)
|
||||
{
|
||||
$this->setSubtitle("Detail Data");
|
||||
return view('admin.mst_hak.show',compact('MstHak'));
|
||||
}
|
||||
|
||||
public function edit(MstHak $MstHak)
|
||||
{
|
||||
$this->setSubtitle("Ubah Data");
|
||||
return view('admin.mst_hak.edit',compact('MstHak'));
|
||||
}
|
||||
|
||||
public function update(Request $request, MstHak $MstHak)
|
||||
{
|
||||
$request->validate([
|
||||
'nama_hak' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$MstHak->update($requestAll);
|
||||
|
||||
return redirect()->route('mst-hak.index')
|
||||
->with('success','Hak berhasil diubah!');
|
||||
}
|
||||
|
||||
public function destroy(MstHak $MstHak)
|
||||
{
|
||||
$MstHak->delete();
|
||||
|
||||
return redirect()->route('mst-hak.index')
|
||||
->with('success','Hak berhasil dihapus!');
|
||||
}
|
||||
|
||||
public function hakList()
|
||||
{
|
||||
$mstKantor = MstHak::select(["id","nama_hak"])->get();
|
||||
return response()->json($mstKantor);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MstKantor;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MstKantorController extends Controller
|
||||
{
|
||||
public function __construct(){
|
||||
$this->siteTitle = "Data Kantor";
|
||||
parent::__construct();
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data = MstKantor::latest()->paginate(10);
|
||||
|
||||
return view('admin.mst_kantor.index',compact('data'))
|
||||
->with('i', (request()->input('page', 1) - 1) * 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$this->setSubtitle("Tambah Data");
|
||||
return view('admin.mst_kantor.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'nama_kantor' => 'required',
|
||||
'wilayah' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
MstKantor::create($requestAll);
|
||||
|
||||
return redirect()->route('mst-kantor.index')
|
||||
->with('success','Post created successfully.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\MstKantor $MstKantor
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(MstKantor $MstKantor)
|
||||
{
|
||||
$this->setSubtitle("Detail Data");
|
||||
return view('admin.mst_kantor.show',compact('MstKantor'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\MstKantor $MstKantor
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(MstKantor $MstKantor)
|
||||
{
|
||||
$this->setSubtitle("Ubah Data");
|
||||
return view('admin.mst_kantor.edit',compact('MstKantor'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\MstKantor $MstKantor
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, MstKantor $MstKantor)
|
||||
{
|
||||
$request->validate([
|
||||
'nama_kantor' => 'required',
|
||||
'wilayah' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$MstKantor->update($requestAll);
|
||||
|
||||
return redirect()->route('mst-kantor.index')
|
||||
->with('success','Tempat Kerja berhasil diubah!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\MstKantor $MstKantor
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(MstKantor $MstKantor)
|
||||
{
|
||||
$MstKantor->delete();
|
||||
|
||||
return redirect()->route('mst-kantor.index')
|
||||
->with('success','Tempat Kerja berhasil dihapus!');
|
||||
}
|
||||
|
||||
public function kantorList()
|
||||
{
|
||||
$mstKantor = MstKantor::select(["id","nama_kantor","wilayah"])->get();
|
||||
return response()->json($mstKantor);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MstKeputusan;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MstKeputusanController extends Controller
|
||||
{
|
||||
public function __construct(){
|
||||
$this->siteTitle = "Data Keputusan";
|
||||
parent::__construct();
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data = MstKeputusan::latest()->paginate(10);
|
||||
|
||||
return view('admin.mst_keputusan.index',compact('data'))
|
||||
->with('i', (request()->input('page', 1) - 1) * 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$this->setSubtitle("Tambah Data");
|
||||
return view('admin.mst_keputusan.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'nama_keputusan' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
MstKeputusan::create($requestAll);
|
||||
|
||||
return redirect()->route('mst-keputusan.index')
|
||||
->with('success','Post created successfully.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\MstKeputusan $mstKeputusan
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(MstKeputusan $mstKeputusan)
|
||||
{
|
||||
// var_dump($mstKeputusan); exit;
|
||||
$this->setSubtitle("Detail Data");
|
||||
return view('admin.mst_keputusan.show',compact('mstKeputusan'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\MstKeputusan $mstKeputusan
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(MstKeputusan $mstKeputusan)
|
||||
{
|
||||
$this->setSubtitle("Ubah Data");
|
||||
return view('admin.mst_keputusan.edit',compact('mstKeputusan'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\MstKeputusan $mstKeputusan
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, MstKeputusan $mstKeputusan)
|
||||
{
|
||||
$request->validate([
|
||||
'nama_keputusan' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$mstKeputusan->update($requestAll);
|
||||
|
||||
return redirect()->route('mst-keputusan.index')
|
||||
->with('success','Keputusan berhasil diubah!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\MstKeputusan $mstKeputusan
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(MstKeputusan $mstKeputusan)
|
||||
{
|
||||
$mstKeputusan->delete();
|
||||
|
||||
return redirect()->route('mst-keputusan.index')
|
||||
->with('success','Keputusan berhasil dihapus!');
|
||||
}
|
||||
|
||||
public function keputusanList()
|
||||
{
|
||||
$mstKeputusan = MstKeputusan::select(["id","nama_keputusan"])->get();
|
||||
return response()->json($mstKeputusan);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MstKpkd;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MstKpkdController extends Controller
|
||||
{
|
||||
public function __construct(){
|
||||
$this->siteTitle = "Data KPKD";
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = MstKpkd::latest()->paginate(10);
|
||||
|
||||
return view('admin.mst_kpkd.index',compact('data'))
|
||||
->with('i', (request()->input('page', 1) - 1) * 10);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->setSubtitle("Tambah Data");
|
||||
return view('admin.mst_kpkd.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'nama' => 'required',
|
||||
'nip' => 'required',
|
||||
'nrk' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
MstKpkd::create($requestAll);
|
||||
|
||||
return redirect()->route('mst-kpkd.index')
|
||||
->with('success','Data KPKD berhasil dibuat.');
|
||||
}
|
||||
|
||||
public function show(MstKpkd $mstKpkd)
|
||||
{
|
||||
$this->setSubtitle("Detail Data");
|
||||
return view('admin.mst_kpkd.show',compact('mstKpkd'));
|
||||
}
|
||||
|
||||
public function edit(MstKpkd $mstKpkd)
|
||||
{
|
||||
$this->setSubtitle("Ubah Data");
|
||||
return view('admin.mst_kpkd.edit',compact('mstKpkd'));
|
||||
}
|
||||
|
||||
public function update(Request $request, MstKpkd $mstKpkd)
|
||||
{
|
||||
$request->validate([
|
||||
'nama' => 'required',
|
||||
'nip' => 'required',
|
||||
'nrk' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$mstKpkd->update($requestAll);
|
||||
|
||||
return redirect()->route('mst-kpkd.index')
|
||||
->with('success','Data KPKD berhasil diubah!');
|
||||
}
|
||||
|
||||
public function destroy(MstKpkd $mstKpkd)
|
||||
{
|
||||
$mstKpkd->delete();
|
||||
|
||||
return redirect()->route('mst-kpkd.index')
|
||||
->with('success','Data KPKD berhasil dihapus!');
|
||||
}
|
||||
|
||||
public function kpkdList()
|
||||
{
|
||||
$mstKpkd = MstKpkd::where("status_aktif", 1)->select(["id","nama"])->get();
|
||||
return response()->json($mstKpkd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Role;
|
||||
use App\Models\Roless;
|
||||
use App\Models\RoleUser;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class MstPenggunaController extends Controller
|
||||
{
|
||||
public function __construct(){
|
||||
$this->siteTitle = "Data Pengguna";
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = User::where('role_name', "<>", "superadmin")->latest()->paginate(10);
|
||||
return view('admin.mst_pengguna.index',compact('data'))
|
||||
->with('i', (request()->input('page', 1) - 1) * 10);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->setSubtitle("Tambah Data");
|
||||
return view('admin.mst_pengguna.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required',
|
||||
'nrk' => 'required',
|
||||
'password' => 'required',
|
||||
'opt_role' => 'required'
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$requestAll["password"] = \Hash::make($requestAll["password"]);
|
||||
$requestAll["role_name"] = $requestAll["opt_role"];
|
||||
$user=User::create($requestAll);
|
||||
|
||||
$user->roles()->detach();
|
||||
//$user->removeRole($requestAll["opt_role"]);
|
||||
$user->assignRole($requestAll["opt_role"]);
|
||||
|
||||
return redirect()->route('users.index')
|
||||
->with('success','User berhasil dibuat.');
|
||||
}
|
||||
|
||||
public function show(User $user)
|
||||
{
|
||||
$user = User::with("roleUser.role")->where("id",$user->id)->first();
|
||||
$this->setSubtitle("Detail Data");
|
||||
return view('admin.mst_pengguna.show',compact('user'));
|
||||
}
|
||||
|
||||
public function edit(User $user)
|
||||
{
|
||||
$this->setSubtitle("Ubah Data");
|
||||
return view('admin.mst_pengguna.edit',compact('user'));
|
||||
}
|
||||
|
||||
public function update(Request $request, User $user)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required',
|
||||
'opt_role' => 'required'
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$requestAll["role_name"] = $requestAll["opt_role"];
|
||||
$user->update($requestAll);
|
||||
|
||||
$user->roles()->detach();
|
||||
// $user->removeRole($requestAll["opt_role"]);
|
||||
$user->assignRole($requestAll["opt_role"]);
|
||||
|
||||
return redirect()->route('users.index')
|
||||
->with('success','User berhasil diubah!');
|
||||
}
|
||||
|
||||
public function destroy(User $user)
|
||||
{
|
||||
$user->delete();
|
||||
|
||||
return redirect()->route('users.index')
|
||||
->with('success','User berhasil dihapus!');
|
||||
}
|
||||
|
||||
public function roleList()
|
||||
{
|
||||
$mstRole = Roless::where("name","<>","superadmin")->select(["name","name"])->get();
|
||||
return response()->json($mstRole);
|
||||
}
|
||||
|
||||
public function changePass()
|
||||
{
|
||||
return view('admin.mst_pengguna.change_password');
|
||||
}
|
||||
|
||||
public function changePassSubmit(Request $request, $userId)
|
||||
{
|
||||
$request->validate([
|
||||
'old_password' => 'required',
|
||||
'new_password' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$cekUser = User::find($userId);
|
||||
if (\Hash::check($requestAll["old_password"], $cekUser->password)){
|
||||
User::where("id",$userId)->update(["password"=>\Hash::make($requestAll["new_password"])]);
|
||||
|
||||
return redirect()->route('home')
|
||||
->with('success','Kata sandi pengguna berhasil diubah!');
|
||||
}else{
|
||||
return redirect()->route('home')
|
||||
->with('error','Kata sandi gagal diubah!, Kata sandi lama salah!');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\MstTempatKerja;
|
||||
use App\Models\Tropd;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MstTempatKerjaController extends Controller
|
||||
{
|
||||
public function __construct(){
|
||||
$this->siteTitle = "Data Tempat Kerja";
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = MstTempatKerja::latest()->paginate(10);
|
||||
|
||||
return view('admin.mst_tempatkerja.index',compact('data'))
|
||||
->with('i', (request()->input('page', 1) - 1) * 10);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->setSubtitle("Tambah Data");
|
||||
return view('admin.mst_tempatkerja.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'skpd_id' => 'required',
|
||||
'tempat_kerja' => 'required',
|
||||
]);
|
||||
|
||||
$skpd = Tropd::where('I_ID', $request->skpd_id)->first();
|
||||
$requestAll = $request->all();
|
||||
$requestAll["skpd_name"] = $skpd->n_opd;
|
||||
|
||||
MstTempatKerja::create($requestAll);
|
||||
|
||||
return redirect()->route('mst-tempat_kerja.index')
|
||||
->with('success','Post created successfully.');
|
||||
}
|
||||
|
||||
public function show(MstTempatKerja $MstTempatKerja)
|
||||
{
|
||||
$this->setSubtitle("Detail Data");
|
||||
return view('admin.mst_tempatkerja.show',compact('MstTempatKerja'));
|
||||
}
|
||||
|
||||
public function edit(MstTempatKerja $MstTempatKerja)
|
||||
{
|
||||
$this->setSubtitle("Ubah Data");
|
||||
return view('admin.mst_tempatkerja.edit',compact('MstTempatKerja'));
|
||||
}
|
||||
|
||||
public function update(Request $request, MstTempatKerja $MstTempatKerja)
|
||||
{
|
||||
$request->validate([
|
||||
'skpd_id' => 'required',
|
||||
'tempat_kerja' => 'required',
|
||||
]);
|
||||
|
||||
$skpd = Tropd::where('I_ID', $request->skpd_id)->first();
|
||||
$requestAll = $request->all();
|
||||
$requestAll["skpd_name"] = $skpd->n_opd;
|
||||
|
||||
$MstTempatKerja->update($requestAll);
|
||||
|
||||
return redirect()->route('mst-tempat_kerja.index')
|
||||
->with('success','Tempat Kerja berhasil diubah!');
|
||||
}
|
||||
|
||||
public function destroy(MstTempatKerja $MstTempatKerja)
|
||||
{
|
||||
$MstTempatKerja->delete();
|
||||
|
||||
return redirect()->route('mst-tempat_kerja.index')
|
||||
->with('success','Tempat Kerja berhasil dihapus!');
|
||||
}
|
||||
|
||||
public function tempatKerjaList($idUnit){
|
||||
$tempatKerja = MstTempatKerja::select("tempat_kerja")
|
||||
->distinct()
|
||||
->where("id_unit",$idUnit)
|
||||
->get()->toArray();
|
||||
|
||||
$arrColumn = array_column($tempatKerja,"tempat_kerja");
|
||||
return response()->json($arrColumn);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Permission;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PermissionsController extends Controller
|
||||
{
|
||||
public function __construct(){
|
||||
$this->siteTitle = "Data Permissions";
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = Permission::latest()->paginate(10);
|
||||
|
||||
return view('admin.mst_permission.index',compact('data'))
|
||||
->with('i', (request()->input('page', 1) - 1) * 10);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->setSubtitle("Tambah Data");
|
||||
return view('admin.mst_permission.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$requestAll['guard_name'] = 'web';
|
||||
Permission::create($requestAll);
|
||||
|
||||
return redirect()->route('permissions.index')
|
||||
->with('success','Permission berhasil dibuat.');
|
||||
}
|
||||
|
||||
public function show(Permission $permission)
|
||||
{
|
||||
$this->setSubtitle("Detail Data");
|
||||
return view('admin.mst_permission.show',compact('permission'));
|
||||
}
|
||||
|
||||
public function edit(Permission $permission)
|
||||
{
|
||||
$this->setSubtitle("Ubah Data");
|
||||
return view('admin.mst_permission.edit',compact('permission'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Permission $permission)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$permission->update($requestAll);
|
||||
|
||||
return redirect()->route('permissions.index')
|
||||
->with('success','Permission berhasil diubah!');
|
||||
}
|
||||
|
||||
public function destroy(Permission $permission)
|
||||
{
|
||||
$permission->delete();
|
||||
return redirect()->route('permissions.index')
|
||||
->with('success','Permission berhasil dihapus!');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Roless;
|
||||
use App\Models\RolePermission;
|
||||
use App\Models\Permission;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RolessController extends Controller
|
||||
{
|
||||
public function __construct(){
|
||||
$this->siteTitle = "Data Roles";
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = Roless::where("name","<>","superadmin")->latest()->paginate(10);
|
||||
|
||||
return view('admin.mst_role.index',compact('data'))
|
||||
->with('i', (request()->input('page', 1) - 1) * 10);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->setSubtitle("Tambah Data");
|
||||
return view('admin.mst_role.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$requestAll['guard_name'] = 'web';
|
||||
Roless::create($requestAll);
|
||||
|
||||
return redirect()->route('roless.index')
|
||||
->with('success','Role berhasil dibuat.');
|
||||
}
|
||||
|
||||
public function show(Roless $roless)
|
||||
{
|
||||
$this->setSubtitle("Detail Data");
|
||||
$permissions = Permission::get();
|
||||
$rolePermissions = RolePermission::where("role_id",$roless->id)->get()->toArray();
|
||||
$rolePermissions = array_column($rolePermissions, 'permission_id');
|
||||
return view('admin.mst_role.show',compact('roless','permissions','rolePermissions'));
|
||||
}
|
||||
|
||||
public function edit(Roless $roless)
|
||||
{
|
||||
$this->setSubtitle("Ubah Data");
|
||||
return view('admin.mst_role.edit',compact('roless'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Roless $roless)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
$roless->update($requestAll);
|
||||
|
||||
return redirect()->route('roless.index')
|
||||
->with('success','Role berhasil diubah!');
|
||||
}
|
||||
|
||||
public function permissions($roleId, Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'role_permission' => 'required',
|
||||
]);
|
||||
|
||||
$requestAll = $request->all();
|
||||
RolePermission::where("role_id", $roleId)->delete();
|
||||
$role_permission = $requestAll["role_permission"];
|
||||
foreach($role_permission as $row_permission){
|
||||
RolePermission::create([
|
||||
"permission_id"=>$row_permission,
|
||||
"role_id"=>$roleId
|
||||
]);
|
||||
}
|
||||
|
||||
return redirect()->route('roless.index')
|
||||
->with('success','Role berhasil diubah!');
|
||||
}
|
||||
|
||||
public function destroy(Roless $roless)
|
||||
{
|
||||
$roless->delete();
|
||||
return redirect()->route('roless.index')
|
||||
->with('success','Role berhasil dihapus!');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Validator;
|
||||
use Hash;
|
||||
use Session;
|
||||
use App\Models\User;
|
||||
use App\Models\RoleUser;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
public function showFormLogin()
|
||||
{
|
||||
if (Auth::check()) { // true sekalian session field di users nanti bisa dipanggil via Auth
|
||||
//Login Success
|
||||
return redirect()->route('home');
|
||||
}
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function login(Request $request)
|
||||
{
|
||||
$rules = [
|
||||
'nrk' => 'required|string',
|
||||
'password' => 'required|string'
|
||||
];
|
||||
|
||||
$messages = [
|
||||
'nrk.required' => 'NRK wajib diisi',
|
||||
'nrk.string' => 'NRK tidak valid',
|
||||
'password.required' => 'Password wajib diisi',
|
||||
'password.string' => 'Password harus berupa string'
|
||||
];
|
||||
|
||||
$validator = Validator::make($request->all(), $rules, $messages);
|
||||
|
||||
if($validator->fails()){
|
||||
return redirect()->back()->withErrors($validator)->withInput($request->all);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'nrk' => $request->input('nrk'),
|
||||
'password' => $request->input('password'),
|
||||
];
|
||||
|
||||
Auth::attempt($data);
|
||||
|
||||
if (Auth::check()) { // true sekalian session field di users nanti bisa dipanggil via Auth
|
||||
//Login Success
|
||||
return redirect()->route('home');
|
||||
|
||||
} else { // false
|
||||
|
||||
//Login Fail
|
||||
Session::flash('error', 'NRK atau password salah');
|
||||
return redirect()->route('login');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function showFormRegister()
|
||||
{
|
||||
return view('register');
|
||||
}
|
||||
|
||||
public function register(Request $request)
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required|min:3|max:35',
|
||||
'nrk' => 'required|min:5|unique:users,nrk',
|
||||
'password' => 'required|confirmed'
|
||||
];
|
||||
|
||||
$messages = [
|
||||
'name.required' => 'Nama Lengkap wajib diisi',
|
||||
'name.min' => 'Nama lengkap minimal 3 karakter',
|
||||
'name.max' => 'Nama lengkap maksimal 35 karakter',
|
||||
'nrk.required' => 'NRK wajib diisi',
|
||||
'nrk.min' => 'NRK tidak valid',
|
||||
'nrk.unique' => 'NRK sudah terdaftar',
|
||||
'password.required' => 'Password wajib diisi',
|
||||
'password.confirmed' => 'Password tidak sama dengan konfirmasi password'
|
||||
];
|
||||
|
||||
$validator = Validator::make($request->all(), $rules, $messages);
|
||||
|
||||
if($validator->fails()){
|
||||
return redirect()->back()->withErrors($validator)->withInput($request->all);
|
||||
}
|
||||
|
||||
$user = new User;
|
||||
$user->name = ucwords(strtolower($request->name));
|
||||
$user->nrk = strtolower($request->nrk);
|
||||
$user->password = Hash::make($request->password);
|
||||
// $user->email_verified_at = \Carbon\Carbon::now();
|
||||
$simpan = $user->save();
|
||||
|
||||
$roleUser = new RoleUser;
|
||||
$roleUser->role_id = 3;
|
||||
$roleUser->user_id = $user->id;
|
||||
$roleUser->save();
|
||||
|
||||
if($simpan){
|
||||
Session::flash('success', 'Register berhasil! Silahkan login untuk mengakses data');
|
||||
return redirect()->route('login');
|
||||
} else {
|
||||
Session::flash('errors', ['' => 'Register gagal! Silahkan ulangi beberapa saat lagi']);
|
||||
return redirect()->route('register');
|
||||
}
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
Auth::logout(); // menghapus session yang aktif
|
||||
return redirect()->route('login');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use View;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
public $siteTitle = "Beranda";
|
||||
public $sitesubTitle = "Data";
|
||||
public $siteBreadcumb =[["url"=>"/","label"=>"Beranda"]];
|
||||
|
||||
public function __construct() {
|
||||
View::share ( 'siteTitle' , $this->siteTitle );
|
||||
View::share ( 'sitesubTitle' , $this->sitesubTitle );
|
||||
View::share ( 'siteBreadcumb' , $this->siteBreadcumb );
|
||||
}
|
||||
|
||||
public function setSubtitle($name){
|
||||
View::share ( 'sitesubTitle' , $name );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('home');
|
||||
}
|
||||
|
||||
public function uploadThis(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'file' => 'required',
|
||||
]);
|
||||
|
||||
$file = $request->file('file');
|
||||
$fileContent = $file->get();
|
||||
// echo 'File Name: '.$file->getClientOriginalName();
|
||||
// echo 'File Extension: '.$file->getClientOriginalExtension();
|
||||
// echo 'File Real Path: '.$file->getRealPath();
|
||||
// echo 'File Size: '.$file->getSize();
|
||||
// echo 'File Mime Type: '.$file->getMimeType();
|
||||
|
||||
// Encrypt File
|
||||
$encryptedContent = encrypt($fileContent);
|
||||
\Storage::put('file.dat', $encryptedContent);
|
||||
}
|
||||
|
||||
public function downloadThis(Request $request)
|
||||
{
|
||||
// Decrypt File
|
||||
$encryptedContent = \Storage::get('file.dat');
|
||||
$decryptedContent = decrypt($encryptedContent);
|
||||
|
||||
return response()->streamDownload(function() use ($decryptedContent) {
|
||||
echo $decryptedContent;
|
||||
}, 'file.jpg');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\SubKegiatan;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ItemSearchController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function sk(Request $request)
|
||||
{
|
||||
$tropd = [];
|
||||
|
||||
if($request->has('q')){
|
||||
$search = strtoupper($request->q);
|
||||
$tropd = SubKegiatan::select(["SUBKEG_KODE as id","SUBKEG_NAMA as name"])
|
||||
->where('SUBKEG_NAMA', 'LIKE', "%$search%")
|
||||
->distinct()
|
||||
->get();
|
||||
}
|
||||
return response()->json($tropd);
|
||||
}
|
||||
|
||||
public function rsk(Request $request)
|
||||
{
|
||||
$tropd = [];
|
||||
|
||||
if($request->has('q')){
|
||||
$search = strtoupper($request->q);
|
||||
$tropd = Tropd::select(["I_ID as id","N_OPD as name"])
|
||||
->where('N_OPD', 'LIKE', "%$search%")
|
||||
->get();
|
||||
}
|
||||
return response()->json($tropd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\TxSkpp;
|
||||
use Illuminate\Http\Request;
|
||||
use PHPJasper\PHPJasper;
|
||||
|
||||
class LaporanController extends Controller
|
||||
{
|
||||
|
||||
public function __construct(){
|
||||
$this->siteTitle = "Laporan";
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->setSubtitle("Laporan");
|
||||
return view('laporan.index');
|
||||
}
|
||||
|
||||
public function showReport(Request $request)
|
||||
{
|
||||
$req = $request->all();
|
||||
$date = explode("-", $req["periode"]);
|
||||
$params = [
|
||||
"Periode"=>$req["report_type"],
|
||||
"Date1"=>ConvertIndoDate(trim($date[0])),
|
||||
"Date2"=>ConvertIndoDate(trim($date[1])),
|
||||
];
|
||||
// var_dump($params); exit;
|
||||
$fileReport = reportProceed("laporan_skpp","laporan_skpp", $params);
|
||||
return response()->file($fileReport);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,407 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\MstGolongan;
|
||||
use App\Models\MstKantor;
|
||||
use App\Models\MstKeputusan;
|
||||
use App\Models\MstHak;
|
||||
use App\Models\MstUnit;
|
||||
use App\Models\TxSkpp;
|
||||
use App\Models\TxSkppHst;
|
||||
use App\Models\TxKeluarga;
|
||||
use App\Models\TxTerbilang;
|
||||
use App\Models\TxSkppUtang;
|
||||
use App\Exports\SkppHstExport;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class SalurdanaController extends Controller
|
||||
{
|
||||
public function __construct(){
|
||||
$this->siteTitle = "Data Salur Dana";
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('salurdana.index')
|
||||
->with('i', (request()->input('page', 1) - 1) * 10);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
// if (!Auth::user()->can("Tambah SKPP")){
|
||||
// abort(403, 'Youre not allowed to visit this page!');
|
||||
// }
|
||||
$this->setSubtitle("Tambah Data");
|
||||
return view('salurdana.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
try{
|
||||
$date = date("Ymd");
|
||||
DB::beginTransaction();
|
||||
|
||||
$req = $request->all();
|
||||
// var_dump($req); exit;
|
||||
$data = $this->setInputData($req);
|
||||
$noUrut = date("ymd")."00001";
|
||||
$cekNoUrut = TxSkpp::select(["id_pen"])
|
||||
->whereRaw("date(created_at)='".date("Y-m-d")."'")
|
||||
->orderBy("created_at","DESC")
|
||||
->first();
|
||||
|
||||
if ($cekNoUrut){
|
||||
$noUrut = substr($cekNoUrut["id_pen"], -5) + 1;
|
||||
$noUrut = date("ymd").substr("00000".$noUrut, -5);
|
||||
}
|
||||
|
||||
$data["id_pen"] = $noUrut;
|
||||
$data["no_skpp"] = $noUrut."/SKPP/073.521";
|
||||
$data["created_by"] = Auth::user()->id;
|
||||
|
||||
$cekData = TxSkpp::where("nip", $data["nip"])
|
||||
->orWhere("nrk", $data["nrk"])
|
||||
->first();
|
||||
|
||||
if ($cekData){
|
||||
throw new \Exception("Data dengan NIP ".$data["nip"]." Sudah ada");
|
||||
}
|
||||
|
||||
$TSkpp = TxSkpp::create($data);
|
||||
DB::commit();
|
||||
|
||||
return redirect()->route('tx-salurdana.index')
|
||||
->with('success','SKPP berhasil dibuat.');
|
||||
}catch(\Exception $e){
|
||||
|
||||
DB::rollBack();
|
||||
return redirect()->route('tx-salurdana.index')
|
||||
->with('error',$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected function setInputData($req){
|
||||
$dinas = MstUnit::where("N_OPD", $req["personal"]["nama_dinas"])->first();
|
||||
|
||||
$data["nama"]=$req["personal"]["nama"];
|
||||
$data["nip"]=$req["personal"]["nip"];
|
||||
$data["nrk"]=$req["personal"]["nrk"];
|
||||
$data["golongan"]=$req["personal"]["golongan_id"];
|
||||
$data["status_pegawai"]=$req["personal"]["status_kepegawaian"];
|
||||
$data["id_unit"]=isset($dinas["I_ID"])?$dinas["I_ID"]:0;
|
||||
$data["dinas"]=$req["personal"]["nama_dinas"];
|
||||
$data["tugas"]=$req["personal"]["tempat_tugas"];
|
||||
$data["tgl_akhir"]=ConvertIndoDate($req["personal"]["penerimaan_gaji_akhir"]);
|
||||
$data["id_kep"]=$req["keputusan"]["keputusan_id"];
|
||||
$data["no_pen"]=$req["keputusan"]["nomor"];
|
||||
$data["tgl_pen"]=ConvertIndoDate($req["keputusan"]["tgl"]);
|
||||
$data["id_hak"]=$req["keputusan"]["hak_id"];
|
||||
$data["tgl_tmt"]=ConvertIndoDate($req["keputusan"]["tmt"]);
|
||||
$data["keterangan"]=$req["keputusan"]["keterangan_kantor"];
|
||||
$data["nama_kantor1"]=$req["keputusan"]["nama_kantor1"];
|
||||
$data["nama_kantor2"]=$req["keputusan"]["nama_kantor2"];
|
||||
$data["wilayah"]=$req["keputusan"]["wilayah_kantor"];
|
||||
$data["ga_pok"]=replaceMoney($req["rincian_gaji"]["gaji_pokok"]);
|
||||
$data["t_issum"]=replaceMoney($req["rincian_gaji"]["tunjangan_suami_istri"]);
|
||||
$data["t_anak"]=replaceMoney($req["rincian_gaji"]["tunjangan_anak"]);
|
||||
$data["t_lain"]=replaceMoney($req["rincian_gaji"]["tunjangan_lain"]);
|
||||
$data["t_jab"]=replaceMoney($req["rincian_gaji"]["tunjangan_jabatan"]);
|
||||
$data["t_beras"]=replaceMoney($req["rincian_gaji"]["tunjangan_beras"]);
|
||||
$data["tpph"]=replaceMoney($req["rincian_gaji"]["tunjangan_pph"]);
|
||||
$data["bulat"]=replaceMoney($req["rincian_gaji"]["pembulatan"]);
|
||||
$data["p_beras"]=replaceMoney($req["rincian_gaji"]["potongan_beras"]);
|
||||
$data["iuran"]=replaceMoney($req["rincian_gaji"]["potongan_iuran_pfk"]);
|
||||
$data["ppph"]=replaceMoney($req["rincian_gaji"]["potongan_pph"]);
|
||||
$data["lain_2"]=replaceMoney($req["rincian_gaji"]["potongan_lain"]);
|
||||
$data["potong"]=replaceMoney($req["rincian_gaji"]["total_potongan"]); // Total Seluruh potongan
|
||||
$data["gaber"]=replaceMoney($req["rincian_gaji"]["total_gaji_bersih"]); // Total gaji bersih
|
||||
$data["u_gaji1"]=null; // Hutang Gaji 1 date
|
||||
$data["u_gaji2"]=null; // Hutang Gaji 2 date
|
||||
$data["jml_u_gaji"]=0; // Total Hutang Gaji
|
||||
$data["u_beras1"]=null; // Hutang Beras 1 date
|
||||
$data["u_beras2"]=null; // Hutang Beras 2 date
|
||||
$data["jml_u_beras"]=0; // Total Hutang Beras
|
||||
$data["id_kan"]=$req["personal_kepala"]["kantor"];
|
||||
$data["status_id"]=1;
|
||||
$data["id_kpkd"]=$req["id_kpkd"];
|
||||
$data["total_utang"]=replaceMoney($req["rincian_utang"]["total"]);
|
||||
$data["total_utang_angsur"]=replaceMoney($req["rincian_utang"]["angsur"]);
|
||||
$data["total_utang_sisa"]=replaceMoney($req["rincian_utang"]["sisa_utang"]);
|
||||
|
||||
$family = isset($req["family"])?$req["family"]:null;
|
||||
TxKeluarga::where("nip",$data["nip"])->delete();
|
||||
if ($family){
|
||||
foreach($family["nama"] as $key=>$itemFamilyName){
|
||||
if ($itemFamilyName){
|
||||
$dataFamily["nip"] = $data["nip"];
|
||||
$dataFamily["nama"] = $itemFamilyName;
|
||||
$dataFamily["tgl_lahir"] = $family["tgl_lahir"][$key]?ConvertIndoDate($family["tgl_lahir"][$key]):null;
|
||||
$dataFamily["hubungan"] = $family["hubungan"][$key];
|
||||
TxKeluarga::create($dataFamily);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$debt = $req["debt"];
|
||||
if ($debt){
|
||||
TxSkppUtang::where("nip",$data["nip"])->delete();
|
||||
foreach($debt["deskripsi"] as $key=>$itemDebt){
|
||||
if ($itemDebt){
|
||||
$dataDebt["nip"] = $data["nip"];
|
||||
$dataDebt["uraian"] = $itemDebt;
|
||||
$dataDebt["jumlah"] = $debt["jumlah"][$key]?replaceMoney($debt["jumlah"][$key]):0;
|
||||
TxSkppUtang::create($dataDebt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function show(TxSkpp $TxSkpp)
|
||||
{
|
||||
if (!Auth::user()->can("Lihat SKPP")){
|
||||
abort(403, 'Youre not allowed to visit this page!');
|
||||
}
|
||||
$this->setSubtitle("Detail Data");
|
||||
$txSkpp = TxSkpp::where("id", $TxSkpp->id)->with(["mst_golongan","mst_utang","mst_keputusan","mst_hak","mst_kantor"])->first();
|
||||
$txSkppHst = TxSkppHst::where("tx_skpp_id", $TxSkpp->id)->with(["mst_golongan","mst_keputusan","mst_hak","mst_kantor"])->orderBy("created_at","DESC")->get();
|
||||
return view('salurdana.show',compact("txSkpp","txSkppHst"));
|
||||
}
|
||||
|
||||
public function edit(TxSkpp $txSkpp)
|
||||
{
|
||||
if (!Auth::user()->can("Ubah SKPP")){
|
||||
abort(403, 'Youre not allowed to visit this page!');
|
||||
}
|
||||
$this->setSubtitle("Ubah Data");
|
||||
$f_edit = "edit";
|
||||
return view('salurdana.edit',compact("txSkpp","f_edit"));
|
||||
}
|
||||
|
||||
public function update(Request $request, TxSkpp $txSkpp)
|
||||
{
|
||||
try{
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
$req = $request->all();
|
||||
$data = $this->setInputData($req);
|
||||
$data["updated_by"] = Auth::user()->id;
|
||||
$txSkpp->update($data);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return redirect()->route('tx-salurdana.index')
|
||||
->with('success','SKPP berhasil diubah.');
|
||||
}catch(Throwable $e){
|
||||
|
||||
DB::rollBack();
|
||||
return redirect()->route('tx-salurdana.index')
|
||||
->with('error','SKPP gagal diubah!');
|
||||
}
|
||||
}
|
||||
|
||||
public function revisi($id)
|
||||
{
|
||||
if (!Auth::user()->can("Ubah SKPP")){
|
||||
abort(403, 'Youre not allowed to visit this page!');
|
||||
}
|
||||
$txSkpp = TxSkpp::where("id", $id)->first();
|
||||
$this->setSubtitle("Revisi Data");
|
||||
$f_edit = "revisi";
|
||||
return view('salurdana.edit',compact("txSkpp","f_edit"));
|
||||
}
|
||||
|
||||
public function revisiStore(Request $request, $id)
|
||||
{
|
||||
try{
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
$txSkpp = TxSkpp::where("id", $id)->first();
|
||||
$txtSkppRevisi = $txSkpp->toArray();
|
||||
$txtSkppRevisi["tx_skpp_id"]=$txtSkppRevisi["id"];
|
||||
unset($txtSkppRevisi["id"]);
|
||||
TxSkppHst::create($txtSkppRevisi);
|
||||
|
||||
$req = $request->all();
|
||||
$revisiNo = intval($txSkpp->f_revisi) + 1;
|
||||
$data = $this->setInputData($req);
|
||||
$data["f_revisi"]=$revisiNo;
|
||||
$data["tgl_cetak"]=null;
|
||||
$data["no_skpp"]="R".$revisiNo."/".$txSkpp->id_pen."/SKPP/073.521";
|
||||
$data["revisi_remarks"]=$req["personal"]["alasan_revisi"];
|
||||
$data["revised_at"] = date("Y-m-d H:i");
|
||||
$data["revised_by"] = Auth::user()->id;
|
||||
$txSkpp->update($data);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return redirect()->route('tx-salurdana.index')
|
||||
->with('success','SKPP berhasil direvisi.');
|
||||
}catch(Throwable $e){
|
||||
|
||||
DB::rollBack();
|
||||
return redirect()->route('tx-salurdana.index')
|
||||
->with('error','SKPP gagal direvisi!');
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy(TxSkpp $txSkpp)
|
||||
{
|
||||
try{
|
||||
DB::beginTransaction();
|
||||
// $txSkpp->delete();
|
||||
$txSkpp->update(["f_deleted"=>1,"deleted_at"=>date("Y-m-d H:i"), "deleted_by"=>Auth::user()->id]);
|
||||
// TxKeluarga::where("nip",$txSkpp["nip"])->delete();
|
||||
// TxSkppUtang::where("nip",$txSkpp["nip"])->delete();
|
||||
DB::commit();
|
||||
return redirect()->route('tx-salurdana.index')
|
||||
->with('success','SKPP berhasil dihapus!');
|
||||
|
||||
}catch(Throwable $e){
|
||||
|
||||
DB::rollBack();
|
||||
return redirect()->route('tx-salurdana.index')
|
||||
->with('error','SKPP gagal di hapus.');
|
||||
}
|
||||
}
|
||||
|
||||
public function datatable(Request $request)
|
||||
{
|
||||
$post = $request->all();
|
||||
$offset = $post["start"];
|
||||
$limit = $post["length"];
|
||||
$src = $post["src"];
|
||||
$srcdate1 = $post["srcDate1"];
|
||||
$srcdate2 = $post["srcDate2"];
|
||||
$statusCetak = $post["statusCetak"];
|
||||
$jenisTgl = $post["jenisTgl"];
|
||||
|
||||
$data = []; $dataFilter=0;
|
||||
$select = DB::raw("id,no_skpp,CONVERT(created_at, DATE) AS tgldibuat,CONVERT(tgl_cetak, DATE) AS tgldicetak,no_pen,nrk,nip,nama,tgl_cetak,f_migrasi_data");
|
||||
if ($src){
|
||||
$data = TxSkpp::select($select)
|
||||
->where("nrk","like","%$src%")
|
||||
->orWhere("nip","like","%$src%")
|
||||
->orWhere("nama","like","%$src%")
|
||||
->orWhere("no_pen","like","%$src%")
|
||||
->orWhere("no_skpp","like","$src%");
|
||||
|
||||
}else{
|
||||
$data = TxSkpp::select($select);
|
||||
}
|
||||
|
||||
$data->whereNull("f_deleted");
|
||||
|
||||
if ($srcdate1 && $srcdate2){
|
||||
$data->whereDate($jenisTgl, ">=", ConvertIndoDate($srcdate1));
|
||||
$data->whereDate($jenisTgl, "<=", ConvertIndoDate($srcdate2));
|
||||
}
|
||||
|
||||
if ($statusCetak){
|
||||
if ($statusCetak == "sudah"){
|
||||
$data->whereNotNull("tgl_cetak");
|
||||
}else{
|
||||
$data->whereNull("tgl_cetak");
|
||||
}
|
||||
}
|
||||
|
||||
$dataFilter = $data->count();
|
||||
$dataTotal = TxSkpp::count();
|
||||
|
||||
return response()->json([
|
||||
"recordsTotal" => $dataTotal,
|
||||
"recordsFiltered" => $dataFilter,
|
||||
"data"=> $data->orderBy("created_at","DESC")->skip($offset)->take($limit)->get()
|
||||
]);
|
||||
}
|
||||
|
||||
function updateTerbilang($idSKPP, $val){
|
||||
TxTerbilang::where("tx_skpp_id",$idSKPP)->delete();
|
||||
return TxTerbilang::create(["tx_skpp_id"=>$idSKPP, "description"=>terbilang($val)]);
|
||||
}
|
||||
|
||||
public function getPegawai(Request $request){
|
||||
// NRK = 178998 181188 181199
|
||||
// $NRK = "181199";
|
||||
$response = Http::withHeaders(
|
||||
['Authorization' => 'Basic ' . base64_encode(env("SOA_PEGAWAI_USER").":".env("SOA_PEGAWAI_PASSWORD"))])
|
||||
->accept('application/json')
|
||||
->get(env("SOA_PEGAWAI")."?nrk=".$request->NRK);
|
||||
$getData = $response->json();
|
||||
if (count($getData["results"])>0){
|
||||
$PEG = $getData["results"][0];
|
||||
$iuranPFK = doubleval($PEG["POTONGAN_THT"]) + doubleval($PEG["POTONGAN_TASPEN"]) + doubleval($PEG["POTONGAN_ASKES_GAJI"]);
|
||||
$tunjanganLain = doubleval($PEG["TUNJANGAN_LAIN"]) + doubleval($PEG["TUNJANGAN_FUNGSIONAL"]);
|
||||
return response()->json([
|
||||
"THBL" => $PEG["THBL"],
|
||||
"NRK"=>$PEG["NRK"],
|
||||
"NAMA"=>$PEG["NAMA"],
|
||||
"NIP"=>$PEG["NIP"],
|
||||
"GOLONGAN"=>$PEG["GOLONGAN"],
|
||||
"PANGKAT"=>$PEG["PANGKAT"],
|
||||
"STATUS"=>$PEG["STATUS"],
|
||||
"PERANGKAT_DAERAH"=>$PEG["PERANGKAT_DAERAH"],
|
||||
"UNIT_KERJA"=>$PEG["UNIT_KERJA"],
|
||||
"GAPOK"=>separateNumberIndo($PEG["GAPOK"]),
|
||||
"NAMA_PASANGAN"=>$PEG["NAMA_PASANGAN"],
|
||||
"TUNJANGAN_ISTRI_SUAMI"=>separateNumberIndo($PEG["TUNJANGAN_ISTRI_SUAMI"]),
|
||||
"TANGGAL_LAHIR_PASANGAN"=>$PEG["TANGGAL_LAHIR_PASANGAN"] == "" ? "":date("d/m/Y",strtotime($PEG["TANGGAL_LAHIR_PASANGAN"])),
|
||||
"ANAKTUNJANG1"=>$PEG["ANAKTUNJANG1"],
|
||||
"TGLAHIRANAK1"=>$PEG["TGLAHIRANAK1"] == "" ? "": date("d/m/Y",strtotime($PEG["TGLAHIRANAK1"])),
|
||||
"ANAKTUNJANG2"=>$PEG["ANAKTUNJANG2"],
|
||||
"TGLAHIRANAK2"=>$PEG["TGLAHIRANAK2"] == "" ? "": date("d/m/Y",strtotime($PEG["TGLAHIRANAK2"])),
|
||||
"ANAKTUNJANG3"=>$PEG["ANAKTUNJANG3"],
|
||||
"TGLAHIRANAK3"=>$PEG["TGLAHIRANAK3"] == "" ? "": date("d/m/Y",strtotime($PEG["TGLAHIRANAK3"])),
|
||||
"TUNJANGAN_ANAK"=>separateNumberIndo($PEG["TUNJANGAN_ANAK"]),
|
||||
"TUNJANGAN_JABATAN"=>separateNumberIndo($PEG["TUNJANGAN_JABATAN"]),
|
||||
"TUNJANGAN_LAIN"=>separateNumberIndo($tunjanganLain),
|
||||
"TUNJANGAN_BERAS"=>separateNumberIndo($PEG["TUNJANGAN_BERAS"]),
|
||||
"TUNJANGAN_PPH"=>0,
|
||||
"PEMBULATAN"=>separateNumberIndo($PEG["PEMBULATAN"]),
|
||||
"IURAN_PFK"=>separateNumberIndo($iuranPFK),
|
||||
"POTONGAN_BERAS"=>0,
|
||||
"POTONGAN_PPH"=>0,
|
||||
"POTONGAN_LAIN"=>0
|
||||
]);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function printData(Request $request)
|
||||
{
|
||||
$req = $request->all();
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
$txSkpp = txSkpp::where("id",$req["id_skpp"])->first();
|
||||
$txSkpp->update(["tgl_cetak"=>date("Y-m-d")]);
|
||||
$this->updateTerbilang($req["id_skpp"], $txSkpp->gaber);
|
||||
|
||||
DB::commit();
|
||||
|
||||
$params = [
|
||||
"ParamId"=>$req["id_skpp"],
|
||||
"serverLocation"=>public_path()
|
||||
];
|
||||
|
||||
$fileReport = reportProceed("skpp","skpp", $params);
|
||||
return response()->file($fileReport);
|
||||
}
|
||||
|
||||
public function exportHst(Request $request, $id)
|
||||
{
|
||||
$req = $request->all();
|
||||
return Excel::download(new SkppHstExport($id),'skpp_hst.xlsx');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Tropd;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SkpdController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function selectSearch(Request $request)
|
||||
{
|
||||
$tropd = [];
|
||||
|
||||
if($request->has('q')){
|
||||
$search = strtoupper($request->q);
|
||||
$tropd = Tropd::select(["I_ID as id","N_OPD as name"])
|
||||
->where('N_OPD', 'LIKE', "%$search%")
|
||||
->get();
|
||||
}
|
||||
return response()->json($tropd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
// 'role' => \App\Http\Middleware\CheckRole::class,
|
||||
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
|
||||
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
|
||||
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CheckRole
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ... $roles)
|
||||
{
|
||||
$hasRole = false;
|
||||
foreach($roles as $role){
|
||||
if ($request->user()->hasRole($role)) {
|
||||
$hasRole = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$hasRole){
|
||||
abort(403, 'This action is unauthorized.');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null ...$guards
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ...$guards)
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
||||
@@ -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
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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|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;
|
||||
}
|
||||
@@ -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
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MstGolongan extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'mst_golongan';
|
||||
protected $fillable = [
|
||||
'nama_golongan', 'nama_pangkat', 'golongan_besar','alias'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MstHak extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'mst_hak';
|
||||
protected $fillable = [
|
||||
'nama_hak'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MstKantor extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'mst_kantor';
|
||||
protected $fillable = [
|
||||
'nama_kantor', 'wilayah'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MstKeputusan extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'mst_keputusan';
|
||||
protected $fillable = [
|
||||
'id', 'nama_keputusan'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MstKpkd extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'mst_kpkd';
|
||||
protected $fillable = [
|
||||
'nama', 'nip', 'nrk', 'status_id'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MstTempatKerja extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'mst_tempatkerja';
|
||||
protected $fillable = [
|
||||
'skpd_id', 'skpd_name', 'tempat_kerja'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MstUnit extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'mst_unit';
|
||||
protected $fillable = [];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Permission extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'permissions';
|
||||
protected $fillable = [
|
||||
'name', 'guard_name'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Role extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RolePermission extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
public $timestamps = false;
|
||||
|
||||
protected $table = 'role_has_permissions';
|
||||
protected $fillable = [
|
||||
'permission_id','role_id'
|
||||
];
|
||||
|
||||
public function role() {
|
||||
return $this->belongsTo('App\Models\Roless','role_id','id');
|
||||
}
|
||||
|
||||
public function permission() {
|
||||
return $this->belongsTo('App\Models\Permission','permission_id','id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoleUser extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'role_id',
|
||||
'user_id',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function role()
|
||||
{
|
||||
return $this->belongsTo(Role::class, 'role_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Permission\Traits\HasPermissions;
|
||||
|
||||
class Roless extends Model
|
||||
{
|
||||
use HasFactory, HasPermissions;
|
||||
protected $table = 'roless';
|
||||
protected $fillable = [
|
||||
'name','guard_name'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Yajra\Oci8\Eloquent\OracleEloquent as Eloquent;
|
||||
|
||||
class SubKegiatan extends Eloquent
|
||||
{
|
||||
use HasFactory;
|
||||
protected $connection = 'oracle2';
|
||||
protected $table = 'BAPEDA_BUDGETING.P_SPB_BELANJARINCIAKB';
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Yajra\Oci8\Eloquent\OracleEloquent as Eloquent;
|
||||
|
||||
class Tropd extends Eloquent
|
||||
{
|
||||
use HasFactory;
|
||||
protected $connection = 'oracle';
|
||||
protected $table = 'NEWSIPKD.TROPD';
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TxKeluarga extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tx_keluarga';
|
||||
protected $fillable = [
|
||||
'nip', 'nama', 'tgl_lahir','hubungan'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TxSkpp extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tx_skpp';
|
||||
protected $fillable = [
|
||||
"id_pen",
|
||||
"nama",
|
||||
"nip",
|
||||
"nrk",
|
||||
"golongan",
|
||||
"status_pegawai",
|
||||
"tugas",
|
||||
"dinas",
|
||||
"tgl_akhir",
|
||||
"akhir",
|
||||
"id_kep",
|
||||
"no_pen",
|
||||
"tgl_pen",
|
||||
"id_hak",
|
||||
"tgl_tmt",
|
||||
"ga_pok",
|
||||
"t_issum",
|
||||
"t_anak",
|
||||
"t_lain",
|
||||
"t_jab",
|
||||
"t_beras",
|
||||
"tpph",
|
||||
"bulat",
|
||||
"p_beras",
|
||||
"iuran",
|
||||
"ppph",
|
||||
"lain_2",
|
||||
"potong",
|
||||
"gaber",
|
||||
"u_gaji1",
|
||||
"u_gaji2",
|
||||
"jml_u_gaji",
|
||||
"u_beras1",
|
||||
"u_beras2",
|
||||
"jml_u_beras",
|
||||
"id_kan",
|
||||
"kon_peg",
|
||||
"status_id",
|
||||
"tgl_cetak",
|
||||
"tgl_peg",
|
||||
"keterangan",
|
||||
"nama_kantor1",
|
||||
"nama_kantor2",
|
||||
"wilayah",
|
||||
"no_skpp",
|
||||
"id_unit",
|
||||
"f_revisi",
|
||||
"revisi_remarks",
|
||||
"id_kpkd",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"revised_at",
|
||||
"revised_by",
|
||||
"total_utang",
|
||||
"total_utang_angsur",
|
||||
"total_utang_sisa",
|
||||
"f_deleted",
|
||||
"deleted_at",
|
||||
"deleted_by"
|
||||
];
|
||||
|
||||
public function mst_keluarga() {
|
||||
return $this->hasMany('App\Models\TxKeluarga','nip','nip');
|
||||
}
|
||||
|
||||
public function mst_utang() {
|
||||
return $this->hasMany('App\Models\TxSkppUtang','nip','nip');
|
||||
}
|
||||
|
||||
public function mst_golongan() {
|
||||
return $this->belongsTo('App\Models\MstGolongan','golongan','id');
|
||||
}
|
||||
|
||||
public function mst_keputusan() {
|
||||
return $this->belongsTo('App\Models\MstKeputusan','id_kep','id');
|
||||
}
|
||||
|
||||
public function mst_hak() {
|
||||
return $this->belongsTo('App\Models\MstHak','id_hak', 'id');
|
||||
}
|
||||
|
||||
public function mst_kantor() {
|
||||
return $this->belongsTo('App\Models\MstKantor','id_kan','id');
|
||||
}
|
||||
|
||||
public function mst_kpkd() {
|
||||
return $this->belongsTo('App\Models\MstKpkd','id_kpkd','id');
|
||||
}
|
||||
|
||||
public function user() {
|
||||
return $this->belongsTo('App\Models\User','created_by','id');
|
||||
}
|
||||
|
||||
public function user_revisi() {
|
||||
return $this->belongsTo('App\Models\User','revised_by','id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TxSkppHst extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tx_skpp_hst';
|
||||
protected $fillable = [
|
||||
"id_pen",
|
||||
"nama",
|
||||
"nip",
|
||||
"nrk",
|
||||
"golongan",
|
||||
"status_pegawai",
|
||||
"tugas",
|
||||
"dinas",
|
||||
"tgl_akhir",
|
||||
"akhir",
|
||||
"id_kep",
|
||||
"no_pen",
|
||||
"tgl_pen",
|
||||
"id_hak",
|
||||
"tgl_tmt",
|
||||
"ga_pok",
|
||||
"t_issum",
|
||||
"t_anak",
|
||||
"t_lain",
|
||||
"t_jab",
|
||||
"t_beras",
|
||||
"tpph",
|
||||
"bulat",
|
||||
"p_beras",
|
||||
"iuran",
|
||||
"ppph",
|
||||
"lain_2",
|
||||
"potong",
|
||||
"gaber",
|
||||
"u_gaji1",
|
||||
"u_gaji2",
|
||||
"jml_u_gaji",
|
||||
"u_beras1",
|
||||
"u_beras2",
|
||||
"jml_u_beras",
|
||||
"id_kan",
|
||||
"kon_peg",
|
||||
"status_id",
|
||||
"tgl_cetak",
|
||||
"tgl_peg",
|
||||
"keterangan",
|
||||
"nama_kantor1",
|
||||
"nama_kantor2",
|
||||
"wilayah",
|
||||
"no_skpp",
|
||||
"id_unit",
|
||||
"f_revisi",
|
||||
"revisi_remarks",
|
||||
"tx_skpp_id"
|
||||
];
|
||||
|
||||
public function mst_keluarga() {
|
||||
return $this->hasMany('App\Models\TxKeluarga','nip','nip');
|
||||
}
|
||||
|
||||
public function mst_golongan() {
|
||||
return $this->belongsTo('App\Models\MstGolongan','golongan','id');
|
||||
}
|
||||
|
||||
public function mst_keputusan() {
|
||||
return $this->belongsTo('App\Models\MstKeputusan','id_kep','id');
|
||||
}
|
||||
|
||||
public function mst_hak() {
|
||||
return $this->belongsTo('App\Models\MstHak','id_hak', 'id');
|
||||
}
|
||||
|
||||
public function mst_kantor() {
|
||||
return $this->belongsTo('App\Models\MstKantor','id_kan','id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TxSkppUtang extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tx_skpp_utang';
|
||||
protected $fillable = [
|
||||
"nip",
|
||||
"uraian",
|
||||
"jumlah",
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TxTerbilang extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'tx_terbilang';
|
||||
protected $fillable = [
|
||||
'tx_skpp_id', 'description'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
<?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;
|
||||
use Illuminate\Support\Str;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable, HasRoles;
|
||||
public $incrementing = false;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'nrk',
|
||||
'password',
|
||||
'role_name'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
//'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function roleUser()
|
||||
{
|
||||
return $this->hasOne(RoleUser::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
protected static function boot() {
|
||||
static::creating(function ($model) {
|
||||
if (!$model->id){
|
||||
$model->id = (string) Str::uuid();
|
||||
}
|
||||
});
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
public function authorizeRoles($roles)
|
||||
{
|
||||
if ($this->hasAnyRole($roles)) {
|
||||
return true;
|
||||
}
|
||||
abort(403, 'This action is unauthorized.');
|
||||
}
|
||||
|
||||
// public function hasAnyRole($roles)
|
||||
// {
|
||||
// if (is_array($roles)) {
|
||||
// foreach ($roles as $role) {
|
||||
// if ($this->hasRole($role)) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// if ($this->hasRole($roles)) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// public function hasRole($role)
|
||||
// {
|
||||
// $hasRole = $this->roleUser()->with(["role"=>function($query) use ($role){
|
||||
// $query->where("name",$role);
|
||||
// }])->first();
|
||||
|
||||
// if ($hasRole->role){
|
||||
// return true;
|
||||
// }else{
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class VwSkppHst extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'vw_skpp_hst';
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Pagination\Paginator;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Paginator::useBootstrap();
|
||||
Schema::defaultStringLength(191);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
*
|
||||
* This is used by Laravel authentication to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/home';
|
||||
|
||||
/**
|
||||
* The controller namespace for the application.
|
||||
*
|
||||
* When present, controller route declarations will automatically be prefixed with this namespace.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
// protected $namespace = 'App\\Http\\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the rate limiters for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class breadcrumb extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('components.breadcrumb');
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
use PHPJasper\PHPJasper;
|
||||
|
||||
function ConvertIndoDate($val){
|
||||
if ($val == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
$arr_date = explode("/", $val);
|
||||
return $arr_date[2] ."-".$arr_date[1]."-".$arr_date[0];
|
||||
}
|
||||
|
||||
function SetToIndoDate($val,$monthYear=false, $full=false){
|
||||
$Month_name = array("","Januari","Februari","Maret",
|
||||
"April","Mei","Juni","Juli","Agustus",
|
||||
"September","Oktober","November","Desember");
|
||||
|
||||
if ($val == null) return "";
|
||||
if ($monthYear){
|
||||
return $Month_name[intval(date("m",strtotime($val)))]." ".date("Y",strtotime($val));
|
||||
}else{
|
||||
if ($full){
|
||||
return date("d",strtotime($val))." ".$Month_name[intval(date("m",strtotime($val)))]." ".date("Y",strtotime($val));
|
||||
}else{
|
||||
return date("d-m-Y",strtotime($val));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function replaceMoney($val){
|
||||
return doubleval(preg_replace("/\D/","",$val));
|
||||
}
|
||||
|
||||
function separateNumberIndo($val){
|
||||
// $numberFormatter = new NumberFormatter( 'id_ID', NumberFormatter::DECIMAL );
|
||||
$numberFormatter = number_format($val);
|
||||
$numberFormatter = str_replace([","],["."],$numberFormatter);
|
||||
return $numberFormatter;
|
||||
}
|
||||
|
||||
function terbilang($val){
|
||||
switch($val){
|
||||
case $val>=1 && $val<=11:
|
||||
$arrBil = ["","Satu","Dua","Tiga","Empat","Lima","Enam","Tujuh","Delapan","Sembilan","Sepuluh","Sebelas"];
|
||||
return $arrBil[$val];
|
||||
break;
|
||||
case $val>=12 && $val<=19:
|
||||
return terbilang($val % 10)." Belas ";
|
||||
break;
|
||||
case $val>=20 && $val<=99:
|
||||
return terbilang(floor($val / 10))." Puluh ".trim(terbilang($val % 10));
|
||||
break;
|
||||
case $val>=100 && $val<=199:
|
||||
return "Seratus ".terbilang($val % 100);
|
||||
break;
|
||||
case $val>=200 && $val<=999:
|
||||
return terbilang(floor($val / 100))." Ratus ".trim(terbilang($val % 100));
|
||||
break;
|
||||
case $val>=1000 && $val<=1999:
|
||||
return "Seribu ".terbilang($val % 1000);
|
||||
break;
|
||||
case $val>=2000 && $val<=999999:
|
||||
return terbilang(floor($val / 1000))." Ribu ".trim(terbilang($val % 1000));
|
||||
break;
|
||||
case $val>=1000000 && $val<=999999999:
|
||||
return terbilang(floor($val / 1000000))." Juta ".trim(terbilang($val % 1000000));
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function reportProceed($source, $reportName, $params = []){
|
||||
$input = resource_path("views/laporan/$source.jrxml");
|
||||
$output = storage_path('app');
|
||||
$options = [
|
||||
'format' => ['pdf'],
|
||||
'params' => $params,
|
||||
'local'=>'en',
|
||||
'db_connection' => [
|
||||
'driver' => 'mysql',
|
||||
'username' => env('DB_USERNAME'),
|
||||
'password' => env('DB_PASSWORD'),
|
||||
'host' => env('DB_HOST'),
|
||||
'database' => env('DB_DATABASE'),
|
||||
'port' => env('DB_PORT')
|
||||
]
|
||||
];
|
||||
|
||||
$jasper = new PHPJasper;
|
||||
$jasper->process(
|
||||
$input,
|
||||
$output,
|
||||
$options
|
||||
)->execute();
|
||||
|
||||
return $output."/$reportName.pdf";
|
||||
}
|
||||
Reference in New Issue
Block a user