このコミットが含まれているのは:
守矢諏訪子 2021-11-01 16:23:03 +09:00
コミット 12052e4189

ファイルの表示

@ -526,18 +526,20 @@ class MeetingsController extends Controller {
if (isset($r->pdf)) { if (isset($r->pdf)) {
$filename = uniqid() . '.pdf'; $filename = uniqid() . '.pdf';
$pdf = base64_decode(substr($r->pdf, strpos($r->pdf, ',') + 1)); $pdf = base64_decode(substr($r->pdf, strpos($r->pdf, ',') + 1));
$update['pdf'] = '/storage/'.$filename;
if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first()) { if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first()) {
if (strcmp($chk->pdf, $pdf) !== 0) { $opdf = str_replace('storage/', '', $chk->pdf);
if (Storage::disk('public')->exists($chk->pdf)) { if (strcmp(Storage::disk('public')->get($opdf), $pdf) !== 0) {
Storage::disk('public')->delete($chk->pdf); if (Storage::disk('public')->exists($opdf)) {
Storage::disk('public')->delete($opdf);
} }
$update['pdf'] = '/storage/'.$filename;
Storage::disk('public')->put($filename, $pdf); Storage::disk('public')->put($filename, $pdf);
} }
} }
else { else {
$update['pdf'] = '/storage/'.$filename;
Storage::disk('public')->put($filename, $pdf); Storage::disk('public')->put($filename, $pdf);
} }
} }