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
2222
2323 protected $ config_reader ;
2424
25+ protected $ groupModel = \LaravelAcl \Authentication \Models \Group::class;
26+
2527 public function __construct ($ config_reader = null )
2628 {
2729 $ this ->sentry = App::make ('sentry ' );
2830 $ this ->config_reader = $ config_reader ? $ config_reader : App::make ('config ' );
2931
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+ }
3235
36+ return parent ::__construct ( new $ this ->groupModel );
37+ }
3338 /**
3439 * Create a new object
3540 *
Original file line number Diff line number Diff line change 1515use Illuminate \Support \Facades \Config ;
1616use LaravelAcl \Authentication \Exceptions \UserExistsException ;
1717use LaravelAcl \Authentication \Exceptions \UserNotFoundException as NotFoundException ;
18- use LaravelAcl \Authentication \Models \Group ;
19- use LaravelAcl \Authentication \Models \User ;
2018use LaravelAcl \Authentication \Repository \Interfaces \UserRepositoryInterface ;
2119use LaravelAcl \Library \Repository \EloquentBaseRepository ;
2220
@@ -29,14 +27,22 @@ class SentryUserRepository extends EloquentBaseRepository implements UserReposit
2927 */
3028 protected $ sentry ;
3129
32- protected $ groupModel = NULL ;
30+ protected $ groupModel = \LaravelAcl \Authentication \Models \Group::class;
31+ protected $ userModel = \LaravelAcl \Authentication \Models \User::class;
3332
3433 public function __construct ()
3534 {
3635 $ this ->sentry = App::make ('sentry ' );
37- $ this ->groupModel = $ this ->sentry ->getGroupProvider ();
3836
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 );
4046 }
4147
4248 /**
You can’t perform that action at this time.
0 commit comments