1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 21:54:03 +00:00

Don't hardcode data

This commit is contained in:
Samuel Štancl 2019-10-29 19:53:15 +01:00
parent 7bc58f3980
commit 44b2846bcd

View file

@ -77,7 +77,7 @@ class TenantRepository extends Repository
if (in_array($key, static::customColumns())) {
$record->update([$key => $value]);
} else {
$data = json_decode($record->first(static::dataColumn())->data, true);
$data = json_decode($record->first()->{static::dataColumn()}, true);
$data[$key] = $value;
$record->update([static::dataColumn() => $data]);
@ -89,7 +89,7 @@ class TenantRepository extends Repository
$record = $this->where('id', $tenant->id);
$data = [];
$jsonData = json_decode($record->first(static::dataColumn())->data, true);
$jsonData = json_decode($record->first()->{static::dataColumn()}, true);
foreach ($kvPairs as $key => $value) {
if (in_array($key, static::customColumns())) {
$data[$key] = $value;