fix(gyms): saving no longer fails before the brand-colour migration; upload header image and logo instead of typing paths
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
965a123834
commit
a85bec6851
5 files changed
+104
-26
No files matched your search
@@ -21,6 +21,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
if (!$errors) {
|
||||
$changed = db_gyms_update($pdo, $id, $data);
|
||||
// Uploaded images that were replaced or removed are no longer referenced.
|
||||
foreach (['hero_image', 'logo'] as $f) if (($item[$f] ?? '') !== ($data[$f] ?? '')) gyms_remove_image($item[$f] ?? '');
|
||||
session()->setFlashdata($changed ? 'success' : 'warning', $changed ? 'Ginásio atualizado.' : 'Nenhuma alteração.');
|
||||
header('Location: ' . base_url('views/admin/gyms/edit.php?id=' . $id));
|
||||
exit;
|
||||
@@ -47,7 +49,7 @@ include __DIR__ . '/../../../includes/header.php';
|
||||
<button class="btn btn-sm btn-primary text-nowrap">Editar conteúdo deste</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<form method="POST" class="card shadow-sm"><div class="card-body">
|
||||
<form method="POST" enctype="multipart/form-data" class="card shadow-sm"><div class="card-body">
|
||||
<?= csrf_field() ?>
|
||||
<?php include __DIR__ . '/_form.php'; ?>
|
||||
<div class="mt-4 d-flex gap-2">
|
||||
|
||||
Reference in new issue
Block a user