mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 15:54:03 +00:00
Laravel 6 support
This commit is contained in:
parent
d23dbf18ce
commit
0049a48383
5 changed files with 9 additions and 5 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -16,7 +16,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
laravel: [
|
laravel: [
|
||||||
# "^6.0",
|
"^6.0",
|
||||||
"^7.0"
|
"^7.0"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,10 @@ class Domain extends Model implements Contracts\Domain
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
public static function booted()
|
public static function boot()
|
||||||
{
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
$ensureDomainIsNotOccupied = function (Domain $self) {
|
$ensureDomainIsNotOccupied = function (Domain $self) {
|
||||||
if ($domain = Domain::where('domain', $self->domain)->first()) {
|
if ($domain = Domain::where('domain', $self->domain)->first()) {
|
||||||
if ($domain->getKey() !== $self->getKey()) {
|
if ($domain->getKey() !== $self->getKey()) {
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,10 @@ use Stancl\Tenancy\Contracts\Syncable;
|
||||||
|
|
||||||
class TenantPivot extends Pivot
|
class TenantPivot extends Pivot
|
||||||
{
|
{
|
||||||
public static function booted()
|
public static function boot()
|
||||||
{
|
{
|
||||||
|
parent::boot();
|
||||||
|
|
||||||
static::saved(function (self $pivot) {
|
static::saved(function (self $pivot) {
|
||||||
$parent = $pivot->pivotParent;
|
$parent = $pivot->pivotParent;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use Symfony\Component\HttpFoundation\IpUtils;
|
||||||
|
|
||||||
class CheckTenantForMaintenanceMode extends CheckForMaintenanceMode
|
class CheckTenantForMaintenanceMode extends CheckForMaintenanceMode
|
||||||
{
|
{
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
if (! tenant()) {
|
if (! tenant()) {
|
||||||
throw new TenancyNotInitializedException;
|
throw new TenancyNotInitializedException;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class ScopeSessionsTest extends TestCase
|
||||||
'middleware' => [StartSession::class, InitializeTenancyBySubdomain::class, ScopeSessions::class],
|
'middleware' => [StartSession::class, InitializeTenancyBySubdomain::class, ScopeSessions::class],
|
||||||
], function () {
|
], function () {
|
||||||
Route::get('/foo', function () {
|
Route::get('/foo', function () {
|
||||||
return true;
|
return 'true';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue