1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 00:54:04 +00:00

Apply fixes from StyleCI

This commit is contained in:
stancl 2019-10-27 17:56:53 +00:00 committed by StyleCI Bot
parent e872139c88
commit d2931530bd
3 changed files with 13 additions and 4 deletions

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\StorageDrivers\Database;
use Illuminate\Config\Repository as ConfigRepository;
@ -20,6 +22,7 @@ class DomainRepository extends Repository
public function getTenantDomains($tenant)
{
$id = $tenant instanceof Tenant ? $tenant->id : $tenant;
return $this->where('tenant_id', $id)->get('domain')->toArray();
}

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\StorageDrivers\Database;
use Illuminate\Config\Repository as ConfigRepository;
@ -27,4 +29,4 @@ abstract class Repository
{
return $this->table->$method(...$parameters);
}
}
}

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\StorageDrivers\Database;
use Illuminate\Config\Repository as ConfigRepository;
@ -43,7 +45,7 @@ class TenantRepository extends Repository
$decodedData = $this->decodedData($tenant);
$result = [];
foreach ($keys as $key) {
$result[$key] = $decodedData[$key];
}
@ -74,6 +76,7 @@ class TenantRepository extends Repository
foreach ($kvPairs as $key => $value) {
if (in_array($key, static::customColumns())) {
$data[$key] = $value;
return;
} else {
$jsonData[$key] = $value;
@ -94,6 +97,7 @@ class TenantRepository extends Repository
foreach ($keys as $key => $key) {
if (in_array($key, static::customColumns())) {
$data[$key] = null;
return;
} else {
unset($jsonData[$key]);
@ -117,7 +121,7 @@ class TenantRepository extends Repository
$dataColumn = static::dataColumn();
$decoded = json_decode($columns[$dataColumn], true);
$columns = array_merge($columns, $decoded);
// If $columns[$dataColumn] has been overriden by a value, don't delete the key.
if (! array_key_exists($dataColumn, $decoded)) {
unset($columns[$dataColumn]);
@ -155,4 +159,4 @@ class TenantRepository extends Repository
?? $config->get('tenancy.storage_drivers.db.table_names.tenants')
?? 'tenants';
}
}
}