Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Records cannot be edited once saved to the database #14

Closed
tringuyenduc2903 opened this issue Apr 11, 2024 · 1 comment · Fixed by #18
Closed

[Bug] Records cannot be edited once saved to the database #14

tringuyenduc2903 opened this issue Apr 11, 2024 · 1 comment · Fixed by #18
Assignees
Labels
bug Something isn't working

Comments

@tringuyenduc2903
Copy link

Bug report

What I did

Add a new record -> Edit that record

What I expected to happen

The data was saved successfully after editing

What happened

After editing, old data is still displayed
Quay phim màn hình từ 11-04-2024 08:34:16.webm

What I've already tried to fix it

<?php

namespace Backpack\TranslationManager\Models;
    ...
class TranslationLine extends TranslationLineOriginal
{
    ...
    /**
     * Boot the model.
     */
    public static function boot()
    {
    ...
        static::saved(function (TranslationLine $entry): void {
            if (! $entry->database) { // <- What are the conditions???
                $entry = TranslationLineOriginal::create([
                    'group' => $entry->group,
                    'key' => $entry->key,
                    'text' => $entry->text,
                ]);
            }
        });
    ...
    }
}

Context to replicate the bug - Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

### PHP VERSION:
8.3.4

### PHP EXTENSIONS:
Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, bcmath, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, igbinary, imagick, imap, intl, ldap, exif, msgpack, mysqli, pcov, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, redis, shmop, SimpleXML, soap, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, memcached, swoole, Zend OPcache, xdebug

### LARAVEL VERSION:
11.3.1.0

### BACKPACK PACKAGE VERSIONS:
backpack/activity-log: 2.0.3
backpack/backupmanager: v5.0.2
backpack/basset: 1.3.0
backpack/crud: 6.7.5
backpack/filemanager: 3.0.7
backpack/generators: v4.0.5
backpack/language-switcher: 2.0.0
backpack/logmanager: v5.0.1
backpack/medialibrary-uploaders: 1.2.0
backpack/permissionmanager: 7.2.0
backpack/pro: 2.1.12
backpack/revise-operation: 2.0.0
backpack/theme-tabler: 1.2.8
backpack/translation-manager: 1.0.1
@pxpm
Copy link
Contributor

pxpm commented Apr 11, 2024

Thanks again @tringuyenduc2903 ❤️

I can confirm it was not possible to edit a language line after it's saved into database.

It's fixed in #18

Will tag a new version with the fix in a short time.

Cheers

@pxpm pxpm self-assigned this Apr 11, 2024
@pxpm pxpm added the bug Something isn't working label Apr 11, 2024
@pxpm pxpm added this to This week Apr 11, 2024
@pxpm pxpm moved this to Ready to Merge in This week Apr 11, 2024
@pxpm pxpm linked a pull request Apr 11, 2024 that will close this issue
@pxpm pxpm closed this as completed in #18 Apr 11, 2024
@github-project-automation github-project-automation bot moved this from Ready to Merge to Done in This week Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants