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

Set public key on model

This commit is contained in:
Samuel Štancl 2019-08-09 23:17:10 +02:00
parent 9fcfcf3ae0
commit de025a6a4d
5 changed files with 10 additions and 8 deletions

View file

@ -34,6 +34,10 @@ class TenancyServiceProvider extends ServiceProvider
__DIR__ . '/assets/config.php' => config_path('tenancy.php'), __DIR__ . '/assets/config.php' => config_path('tenancy.php'),
], 'config'); ], 'config');
$this->publishes([
__DIR__ . '/assets/2019_08_08_000000_create_tenants_table.php' => database_path('migrations'),
], 'migrations');
$this->loadRoutesFrom(__DIR__ . '/routes.php'); $this->loadRoutesFrom(__DIR__ . '/routes.php');
Route::middlewareGroup('tenancy', [ Route::middlewareGroup('tenancy', [

View file

@ -9,6 +9,8 @@ class Tenant extends Model
protected $dataColumn = 'data'; protected $dataColumn = 'data';
protected $specialColumns = []; protected $specialColumns = [];
protected $guarded = []; protected $guarded = [];
protected $publicKey = 'uuid';
public $incrementing = false;
/** /**
* Decoded data from the data column. * Decoded data from the data column.

2
test
View file

@ -5,7 +5,7 @@ import argparse
system('docker-compose up -d') system('docker-compose up -d')
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--variants", default='1,2', parser.add_argument("--variants", default='1,2,3',
help="Comma-separated values. Which test variants should be run.") help="Comma-separated values. Which test variants should be run.")
args, other = parser.parse_known_args() args, other = parser.parse_known_args()

View file

@ -109,6 +109,8 @@ class TenantStorageTest extends TestCase
{ {
$value = ['foo' => 'bar', 'abc' => 'xyz']; $value = ['foo' => 'bar', 'abc' => 'xyz'];
dd(\Stancl\Tenancy\Tenant::find(tenant('uuid')));
$this->assertSame($value, tenancy()->put($value)); $this->assertSame($value, tenancy()->put($value));
} }
} }

View file

@ -10,13 +10,6 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
public $autoCreateTenant = true; public $autoCreateTenant = true;
public $autoInitTenancy = true; public $autoInitTenancy = true;
private function checkRequirements(): void
{
parent::checkRequirements();
dd($this->getAnnotations());
}
/** /**
* Setup the test environment. * Setup the test environment.
* *
@ -28,6 +21,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
Redis::connection('tenancy')->flushdb(); Redis::connection('tenancy')->flushdb();
Redis::connection('cache')->flushdb(); Redis::connection('cache')->flushdb();
Artisan::call('migrate');
if ($this->autoCreateTenant) { if ($this->autoCreateTenant) {
$this->createTenant(); $this->createTenant();