Skip to content

Commit 932f2cf

Browse files
Merge pull request #111 from MerQ-ai/master
check the db connection before registering the permissions
2 parents f45f154 + 6e8e749 commit 932f2cf

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All Notable changes to `laravel-permission-mongodb` will be documented in this f
77
### Added
88
- Support of Laravel 7.x
99

10+
v2.1
1011
## 2.0.1 - 2020-02-23
1112

1213
### Changed

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030
}
3131
],
3232
"require": {
33-
"php": ">=7.0",
34-
"illuminate/auth": "^5.2|^6.0|^7.0",
35-
"illuminate/container": "^5.2|^6.0|^7.0",
36-
"illuminate/contracts": "^5.2|^6.0|^7.0",
33+
"php": ">=7.2",
34+
"illuminate/auth": "^6.0",
35+
"illuminate/container": "^6.0",
36+
"illuminate/contracts": "^6.0",
37+
3738
"jenssegers/mongodb": "^3.0"
3839
},
3940
"require-dev": {

src/PermissionServiceProvider.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace Maklad\Permission;
44

5-
use Illuminate\Contracts\Auth\Access\Gate;
65
use Illuminate\Support\ServiceProvider;
76
use Illuminate\View\Compilers\BladeCompiler;
87
use Maklad\Permission\Contracts\PermissionInterface as Permission;
98
use Maklad\Permission\Contracts\RoleInterface as Role;
109
use Maklad\Permission\Directives\PermissionDirectives;
10+
use Illuminate\Support\Facades\DB;
1111

1212
/**
1313
* Class PermissionServiceProvider
@@ -41,9 +41,11 @@ public function boot()
4141

4242
$this->registerModelBindings();
4343

44-
$this->app->afterResolving(Gate::class, function () {
44+
try {
45+
DB::connection()->getPdo();
4546
app(PermissionRegistrar::class)->registerPermissions();
46-
});
47+
} catch (\Exception $e) {
48+
}
4749
}
4850

4951
public function register()

0 commit comments

Comments
 (0)