File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed
app/Authentication/Repository Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,19 @@ class SentryGroupRepository extends EloquentBaseRepository implements BaseReposi
22
22
23
23
protected $ config_reader ;
24
24
25
+ protected $ groupModel = \LaravelAcl \Authentication \Models \Group::class;
26
+
25
27
public function __construct ($ config_reader = null )
26
28
{
27
29
$ this ->sentry = App::make ('sentry ' );
28
30
$ this ->config_reader = $ config_reader ? $ config_reader : App::make ('config ' );
29
31
30
- return parent ::__construct ( $ this ->sentry ->getGroupProvider ()->createModel () );
31
- }
32
+ if (method_exists ($ this ->sentry , 'getGroupProvider ' )) {
33
+ $ this ->groupModel = get_class ( $ this ->sentry ->getGroupProvider ()->createModel ());
34
+ }
32
35
36
+ return parent ::__construct ( new $ this ->groupModel );
37
+ }
33
38
/**
34
39
* Create a new object
35
40
*
Original file line number Diff line number Diff line change 15
15
use Illuminate \Support \Facades \Config ;
16
16
use LaravelAcl \Authentication \Exceptions \UserExistsException ;
17
17
use LaravelAcl \Authentication \Exceptions \UserNotFoundException as NotFoundException ;
18
- use LaravelAcl \Authentication \Models \Group ;
19
- use LaravelAcl \Authentication \Models \User ;
20
18
use LaravelAcl \Authentication \Repository \Interfaces \UserRepositoryInterface ;
21
19
use LaravelAcl \Library \Repository \EloquentBaseRepository ;
22
20
@@ -29,14 +27,22 @@ class SentryUserRepository extends EloquentBaseRepository implements UserReposit
29
27
*/
30
28
protected $ sentry ;
31
29
32
- protected $ groupModel = NULL ;
30
+ protected $ groupModel = \LaravelAcl \Authentication \Models \Group::class;
31
+ protected $ userModel = \LaravelAcl \Authentication \Models \User::class;
33
32
34
33
public function __construct ()
35
34
{
36
35
$ this ->sentry = App::make ('sentry ' );
37
- $ this ->groupModel = $ this ->sentry ->getGroupProvider ();
38
36
39
- return parent ::__construct ( $ this ->sentry ->getUserProvider ()->createModel () );
37
+ if (method_exists ($ this ->sentry , 'getGroupProvider ' )) {
38
+ $ this ->groupModel = get_class ( $ this ->sentry ->getGroupProvider ()->createModel ());
39
+ }
40
+
41
+ if (method_exists ($ this ->sentry , 'getUserProvider ' )) {
42
+ $ this ->userModel = get_class ($ this ->sentry ->getUserProvider ()->createModel ());
43
+ }
44
+
45
+ return parent ::__construct ( new $ this ->userModel );
40
46
}
41
47
42
48
/**
You can’t perform that action at this time.
0 commit comments