mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 04:34:03 +00:00
Apply fixes from StyleCI
This commit is contained in:
parent
e872139c88
commit
d2931530bd
3 changed files with 13 additions and 4 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Stancl\Tenancy\StorageDrivers\Database;
|
namespace Stancl\Tenancy\StorageDrivers\Database;
|
||||||
|
|
||||||
use Illuminate\Config\Repository as ConfigRepository;
|
use Illuminate\Config\Repository as ConfigRepository;
|
||||||
|
|
@ -20,6 +22,7 @@ class DomainRepository extends Repository
|
||||||
public function getTenantDomains($tenant)
|
public function getTenantDomains($tenant)
|
||||||
{
|
{
|
||||||
$id = $tenant instanceof Tenant ? $tenant->id : $tenant;
|
$id = $tenant instanceof Tenant ? $tenant->id : $tenant;
|
||||||
|
|
||||||
return $this->where('tenant_id', $id)->get('domain')->toArray();
|
return $this->where('tenant_id', $id)->get('domain')->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Stancl\Tenancy\StorageDrivers\Database;
|
namespace Stancl\Tenancy\StorageDrivers\Database;
|
||||||
|
|
||||||
use Illuminate\Config\Repository as ConfigRepository;
|
use Illuminate\Config\Repository as ConfigRepository;
|
||||||
|
|
@ -27,4 +29,4 @@ abstract class Repository
|
||||||
{
|
{
|
||||||
return $this->table->$method(...$parameters);
|
return $this->table->$method(...$parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Stancl\Tenancy\StorageDrivers\Database;
|
namespace Stancl\Tenancy\StorageDrivers\Database;
|
||||||
|
|
||||||
use Illuminate\Config\Repository as ConfigRepository;
|
use Illuminate\Config\Repository as ConfigRepository;
|
||||||
|
|
@ -43,7 +45,7 @@ class TenantRepository extends Repository
|
||||||
$decodedData = $this->decodedData($tenant);
|
$decodedData = $this->decodedData($tenant);
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$result[$key] = $decodedData[$key];
|
$result[$key] = $decodedData[$key];
|
||||||
}
|
}
|
||||||
|
|
@ -74,6 +76,7 @@ class TenantRepository extends Repository
|
||||||
foreach ($kvPairs as $key => $value) {
|
foreach ($kvPairs as $key => $value) {
|
||||||
if (in_array($key, static::customColumns())) {
|
if (in_array($key, static::customColumns())) {
|
||||||
$data[$key] = $value;
|
$data[$key] = $value;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
$jsonData[$key] = $value;
|
$jsonData[$key] = $value;
|
||||||
|
|
@ -94,6 +97,7 @@ class TenantRepository extends Repository
|
||||||
foreach ($keys as $key => $key) {
|
foreach ($keys as $key => $key) {
|
||||||
if (in_array($key, static::customColumns())) {
|
if (in_array($key, static::customColumns())) {
|
||||||
$data[$key] = null;
|
$data[$key] = null;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
unset($jsonData[$key]);
|
unset($jsonData[$key]);
|
||||||
|
|
@ -117,7 +121,7 @@ class TenantRepository extends Repository
|
||||||
$dataColumn = static::dataColumn();
|
$dataColumn = static::dataColumn();
|
||||||
$decoded = json_decode($columns[$dataColumn], true);
|
$decoded = json_decode($columns[$dataColumn], true);
|
||||||
$columns = array_merge($columns, $decoded);
|
$columns = array_merge($columns, $decoded);
|
||||||
|
|
||||||
// If $columns[$dataColumn] has been overriden by a value, don't delete the key.
|
// If $columns[$dataColumn] has been overriden by a value, don't delete the key.
|
||||||
if (! array_key_exists($dataColumn, $decoded)) {
|
if (! array_key_exists($dataColumn, $decoded)) {
|
||||||
unset($columns[$dataColumn]);
|
unset($columns[$dataColumn]);
|
||||||
|
|
@ -155,4 +159,4 @@ class TenantRepository extends Repository
|
||||||
?? $config->get('tenancy.storage_drivers.db.table_names.tenants')
|
?? $config->get('tenancy.storage_drivers.db.table_names.tenants')
|
||||||
?? 'tenants';
|
?? 'tenants';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue