Clean up models.

Clean up models.
This commit is contained in:
James Cole
2020-03-25 06:58:39 +01:00
parent 7e6cd77203
commit bcfbdcf3f0
2 changed files with 30 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Preference;
use Illuminate\Console\Command;
use Illuminate\Contracts\Encryption\DecryptException;
use JsonException;
use Log;
/**
@@ -92,7 +93,11 @@ class DecryptDatabase extends Command
// A separate routine for preferences:
if ('preferences' === $table) {
// try to json_decrypt the value.
$value = json_decode($value, true, 512, JSON_THROW_ON_ERROR) ?? $value;
try {
$value = json_decode($value, true, 512, JSON_THROW_ON_ERROR) ?? $value;
} catch(JsonException $e) {
Log::error($e->getMessage());
}
Log::debug(sprintf('Decrypted field "%s" "%s" to "%s" in table "%s" (row #%d)', $field, $original, print_r($value, true), $table, $id));
/** @var Preference $object */

View File

@@ -114,6 +114,30 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @method static Builder|User whereReset($value)
* @method static Builder|User whereUpdatedAt($value)
* @mixin Eloquent
* @property string|null $objectguid
* @property-read int|null $accounts_count
* @property-read int|null $attachments_count
* @property-read int|null $available_budgets_count
* @property-read int|null $bills_count
* @property-read int|null $budgets_count
* @property-read int|null $categories_count
* @property-read int|null $clients_count
* @property-read int|null $currency_exchange_rates_count
* @property-read int|null $import_jobs_count
* @property-read int|null $notifications_count
* @property-read int|null $piggy_banks_count
* @property-read int|null $preferences_count
* @property-read int|null $recurrences_count
* @property-read int|null $roles_count
* @property-read int|null $rule_groups_count
* @property-read int|null $rules_count
* @property-read int|null $tags_count
* @property-read int|null $tokens_count
* @property-read int|null $transaction_groups_count
* @property-read int|null $transaction_journals_count
* @property-read int|null $transactions_count
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\User whereMfaSecret($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\User whereObjectguid($value)
*/
class User extends Authenticatable
{