72 lines
1.9 KiB
PHP
72 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Session;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$this->setIconTitle("fa fa-home");
|
|
return view('home');
|
|
}
|
|
|
|
public function ta($ta)
|
|
{
|
|
Session::put('Tahun_Anggaran', $ta);
|
|
return redirect()->route('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');
|
|
}
|
|
|
|
public function downloadManual()
|
|
{
|
|
$file = "manual_aplikasi_sidata.pdf";
|
|
$headers = [
|
|
'Content-Type' => 'application/pdf',
|
|
'Content-Disposition' => 'attachment;filename='.$file
|
|
];
|
|
return response()->download($file , $file, $headers);
|
|
}
|
|
|
|
public function rekonAnggaran()
|
|
{
|
|
// UPDATE BELANJA_REALISASI t1
|
|
// SET t1.JUMLAH_ANGGARAN = (
|
|
// SELECT V_ANGG_TAPD FROM VW_DPA_RSK t2
|
|
// WHERE t1.KODE_RSK = t2.I_ID
|
|
// )
|
|
// WHERE t1.TAHUN_ANGGARAN = 2022
|
|
}
|
|
}
|