Update dan bugs fix
This commit is contained in:
@@ -13,6 +13,7 @@ use App\Models\User;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class RealisasiPendapatanController extends Controller
|
||||
{
|
||||
@@ -190,7 +191,17 @@ class RealisasiPendapatanController extends Controller
|
||||
$data["rkud_kode_akun"] = $req["rkud_kode_akun"];
|
||||
$data["rkud_nama_akun"] = $req["rkud_nama_akun"];
|
||||
$data["rkud_jumlah"] = replaceMoney($req["rkud_jumlah"]);
|
||||
|
||||
$file = $request->file('file_sts');
|
||||
if ($file){
|
||||
$fileName = $req["rkud_no_sts"].".".$file->getClientOriginalExtension();
|
||||
$tujuan_upload = config('constants.upload_path_sts');
|
||||
File::isDirectory($tujuan_upload) or File::makeDirectory($tujuan_upload, 0777, true, true);
|
||||
$file->move($tujuan_upload, $fileName);
|
||||
$data["file_sts"] = $fileName;
|
||||
}
|
||||
$data->save();
|
||||
|
||||
DB::commit();
|
||||
|
||||
$userAnggaran = User::where("role_name","anggaran")->get()->toArray();
|
||||
@@ -258,4 +269,12 @@ class RealisasiPendapatanController extends Controller
|
||||
return response()->download("downloadFiles/".$fileName, $fileName, $headers);
|
||||
}
|
||||
|
||||
public function downloadSts(PendapatanRealisasi $realisasi)
|
||||
{
|
||||
$headers = [
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'attachment;filename='.$realisasi->file_sts
|
||||
];
|
||||
return response()->download(config('constants.upload_path_sts').$realisasi->file_sts, $realisasi->file_sts, $headers);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user