routes eula agreements for download correctly to the asset history

This commit is contained in:
Godfrey M
2022-03-16 11:51:40 -07:00
parent 6386fa1c5e
commit 5fcc3c39f3
6 changed files with 19 additions and 49 deletions
@@ -107,7 +107,7 @@ class AcceptanceController extends Controller
$data_uri = e($request->input('signature_output'));
$encoded_image = explode(',', $data_uri);
$decoded_image = base64_decode($encoded_image[1]);
$acceptance->stored_eula_file = 'private_uploads/eula-pdfs/accepted-eula-'.date('Y-m-d-h-i-s').'.pdf';
$acceptance->stored_eula_file = 'accepted-eula-'.date('Y-m-d-h-i-s').'.pdf';
$path = Storage::put('private_uploads/signatures/'.$sig_filename, (string) $decoded_image);
}
@@ -136,10 +136,9 @@ class AcceptanceController extends Controller
'logo' => public_path().'/uploads/snipe-logo.png',
];
\Log::error(storage_path().'/eula-pdfs/'.$sig_filename);
$pdf = Pdf::loadView('account.accept.accept-eula', $data);
Storage::put($acceptance->stored_eula_file, $pdf->output());
Storage::put('private_uploads/eula-pdfs/'.$acceptance->stored_eula_file, $pdf->output());
$a=new Actionlog();
$a->stored_eula = $item->getEula();
$a->stored_eula_file = $acceptance->stored_eula_file;
+6 -1
View File
@@ -8,7 +8,6 @@ use Response;
class ActionlogController extends Controller
{
public function displaySig($filename)
{
$this->authorize('view', \App\Models\Asset::class);
@@ -18,4 +17,10 @@ class ActionlogController extends Controller
return Response::make($contents)->header('Content-Type', $filetype);
}
public function getStoredEula($filename){
$this->authorize('view', \App\Models\Asset::class);
$file = config('app.private_uploads').'/eula-pdfs/'.$filename;
return Response::download($file);
}
}
@@ -112,7 +112,7 @@ class ActionlogsTransformer
'signature_file' => ($actionlog->accept_signature) ? route('log.signature.view', ['filename' => $actionlog->accept_signature ]) : null,
'log_meta' => ((isset($clean_meta)) && (is_array($clean_meta))) ? $clean_meta: null,
'action_date' => ($actionlog->action_date) ? Helper::getFormattedDateObject($actionlog->action_date, 'datetime'): Helper::getFormattedDateObject($actionlog->created_at, 'datetime'),
'stored_eula_file' => $actionlog->stored_eula_file,
'stored_eula_file' => ($actionlog->stored_eula_file) ? route('log.storedeula.download', ['filename' => $actionlog->stored_eula_file]) : null,
];
return $array;