fix files

This commit is contained in:
hafifierahman
2022-04-12 11:00:52 +08:00
parent c401f17f7d
commit 62d1252f4e
4 changed files with 62 additions and 4 deletions
+24 -1
View File
@@ -26,6 +26,7 @@ use App\Pengesahan;
use App\Permohonan;
use App\Status;
use App\LookupStatus;
use App\KPFiles;
use DB;
use Carbon\Carbon;
@@ -2093,6 +2094,7 @@ class AdminPageController extends Controller
{
$timeloni = Carbon::now();
$status = new Status;
$kp_files = new KPFiles;
try{
@@ -2103,10 +2105,16 @@ class AdminPageController extends Controller
$status->tarikhmasa = $timeloni->toDateTimeString();
$status->save();
$kp_files->data = $request->dataimage;
$kp_files->type = $request->imagetype;
$kp_files->filename = $request->imagename;
$kp_files->tarikhmasa = $timeloni->toDateTimeString();
$kp_files->save();
$pengesahan = Pengesahan::where([['mohonid',$request->mohonid],['tagpb',0]])
->update(array(
'tagpb' => 1,
'kelulusanpbimage' => $request->kelulusanpbimage
'kp_id' => $kp_files->id
));
$permohonan = Permohonan::where('mohonid',$request->mohonid)
@@ -2230,4 +2238,19 @@ class AdminPageController extends Controller
return response($e);
}
}
public function viewFile(Request $request) {
// $data = \DB::connection($conn)
// ->table($tbl)
// ->where('filename', $filename)
// ->first();
$kp = KPFiles::where('kp_id',$request->kp_id)
->first();
return response(base64_decode(stream_get_contents($kp->data)), 200, [
'Content-type' => 'application/' . $kp->type,
'Content-Disposition' => 'inline; filename='.$kp->filename
]);
}
}