From 6b4ef567c31f27bafef9e91e705b8b47671e46e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henry=20=C3=81vila?= Date: Tue, 19 Sep 2023 13:04:27 -0300 Subject: [PATCH] Fix update Model with no file --- CHANGELOG.md | 3 +++ composer.json | 2 +- config/nova-multitenancy.php | 3 +++ resources/lang/pt_BR.json | 3 ++- src/Http/Middleware/SetTenantMiddleware.php | 4 ++++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3bea2e..ed364a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to `laravel-nova-multitenancy` will be documented in this file. +## v3.1.0 - 2023-09-19 +Abort if domain is required and domain is not found + ## v3.0.4 - 2023-09-01 Fix calc of files size diff --git a/composer.json b/composer.json index e3326b6..5b80827 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "henryavila/laravel-nova-multitenancy", - "version": "3.0.5", + "version": "3.1.0", "description": "Integrate the multi tenancy single database in Laravel Nova.", "keywords": [ "henryavila", diff --git a/config/nova-multitenancy.php b/config/nova-multitenancy.php index 57963b9..92ef039 100644 --- a/config/nova-multitenancy.php +++ b/config/nova-multitenancy.php @@ -34,6 +34,9 @@ // if null, will deactivate the Tenant finder by domain 'domain_class' => null, + // If set to true and a 'domain_class' is defined, will throw a 403 error if the current site domain is not find on Tenant + 'must_find_tenant_on_domain' => false, + 'fqdn_column' => 'fqdn', // This invokable class will be executed after the Tenant has been set as current tenant diff --git a/resources/lang/pt_BR.json b/resources/lang/pt_BR.json index f9c83ac..337e45d 100644 --- a/resources/lang/pt_BR.json +++ b/resources/lang/pt_BR.json @@ -1,5 +1,6 @@ { "Você precisa estar vinculado a alguma conta.": "Você precisa estar vinculado a alguma conta.", "Você não possui nenhuma conta vinculada ao seu usuário.": "Você não possui nenhuma conta vinculada ao seu usuário.", - "Selecione uma conta": "Selecione uma conta" + "Selecione uma conta": "Selecione uma conta", + "Domínio não encontrado!": "Domínio não encontrado!" } diff --git a/src/Http/Middleware/SetTenantMiddleware.php b/src/Http/Middleware/SetTenantMiddleware.php index 1e1350c..56b1b89 100644 --- a/src/Http/Middleware/SetTenantMiddleware.php +++ b/src/Http/Middleware/SetTenantMiddleware.php @@ -48,6 +48,10 @@ public function handle($request, Closure $next) return $next($request); } + + if (config('nova-multitenancy.must_find_tenant_on_domain')) { + abort(403, trans('Domínio não encontrado!')); + } } // If the user came from Tenant Selection, let's get data from session and save the tenant