Skip to content

Commit

Permalink
Fix Tenant quota usage < 0
Browse files Browse the repository at this point in the history
  • Loading branch information
henryavila committed Sep 1, 2023
1 parent 4c045e8 commit d70f5a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "henryavila/laravel-nova-multitenancy",
"version": "3.0.2",
"version": "3.0.3",
"description": "Integrate the multi tenancy single database in Laravel Nova.",
"keywords": [
"henryavila",
Expand Down
11 changes: 11 additions & 0 deletions src/Models/Tenant.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ class Tenant extends \Spatie\Multitenancy\Models\Tenant
'disk_usage_in_bytes' => 'int',
];

protected static function booted(): void
{
parent::booted();

static::updating(function ($tenant) {
if ($tenant->disk_usage_in_bytes < 0) {
$tenant->disk_usage_in_bytes = null;
}
});

}
/**
* Is there any Tenant selected
*/
Expand Down

0 comments on commit d70f5a6

Please sign in to comment.