@@ -13,75 +13,75 @@ |
||
13 | 13 | |
14 | 14 | Route::group(['prefix' => 'acl'], function () { |
15 | 15 | |
16 | - Route::group(['prefix' => 'users'], function () { |
|
16 | + Route::group(['prefix' => 'users'], function () { |
|
17 | 17 | |
18 | - Route::get('list/{sortBy?}/{desc?}', 'UsersController@index'); |
|
19 | - Route::get('find/{id}', 'UsersController@find'); |
|
20 | - Route::get('search/{query?}/{perPage?}/{sortBy?}/{desc?}', 'UsersController@search'); |
|
21 | - Route::get('paginate/{perPage?}/{sortBy?}/{desc?}', 'UsersController@paginate'); |
|
22 | - Route::get('delete/{id}', 'UsersController@delete'); |
|
23 | - Route::get('restore/{id}', 'UsersController@restore'); |
|
24 | - Route::get('account', 'UsersController@account'); |
|
25 | - Route::get('block/{id}', 'UsersController@block'); |
|
26 | - Route::get('unblock/{id}', 'UsersController@unblock'); |
|
27 | - Route::get('logout', 'UsersController@logout'); |
|
28 | - Route::post('refreshtoken', 'UsersController@refreshtoken'); |
|
29 | - Route::post('first', 'UsersController@first'); |
|
30 | - Route::post('findby/{sortBy?}/{desc?}', 'UsersController@findby'); |
|
31 | - Route::post('paginateby/{perPage?}/{sortBy?}/{desc?}', 'UsersController@paginateby'); |
|
32 | - Route::post('save', 'UsersController@save'); |
|
33 | - Route::post('profile/save', 'UsersController@saveProfile'); |
|
34 | - Route::post('deleted/{perPage?}/{sortBy?}/{desc?}', 'UsersController@deleted'); |
|
35 | - Route::post('register', 'UsersController@register'); |
|
36 | - Route::post('login', 'UsersController@login'); |
|
37 | - Route::post('login/social', 'UsersController@loginSocial'); |
|
38 | - Route::post('assigngroups', 'UsersController@assigngroups'); |
|
39 | - Route::post('sendreset', 'UsersController@sendreset'); |
|
40 | - Route::post('resetpassword', 'UsersController@resetpassword'); |
|
41 | - Route::post('changepassword', 'UsersController@changePassword'); |
|
42 | - Route::post('confirm/email', 'UsersController@confirmEmail'); |
|
43 | - Route::post('resend/email/confirmation', 'UsersController@resendEmailConfirmation'); |
|
44 | - Route::post('group/{groupName}/{perPage?}/{sortBy?}/{desc?}', 'UsersController@group'); |
|
45 | - }); |
|
18 | + Route::get('list/{sortBy?}/{desc?}', 'UsersController@index'); |
|
19 | + Route::get('find/{id}', 'UsersController@find'); |
|
20 | + Route::get('search/{query?}/{perPage?}/{sortBy?}/{desc?}', 'UsersController@search'); |
|
21 | + Route::get('paginate/{perPage?}/{sortBy?}/{desc?}', 'UsersController@paginate'); |
|
22 | + Route::get('delete/{id}', 'UsersController@delete'); |
|
23 | + Route::get('restore/{id}', 'UsersController@restore'); |
|
24 | + Route::get('account', 'UsersController@account'); |
|
25 | + Route::get('block/{id}', 'UsersController@block'); |
|
26 | + Route::get('unblock/{id}', 'UsersController@unblock'); |
|
27 | + Route::get('logout', 'UsersController@logout'); |
|
28 | + Route::post('refreshtoken', 'UsersController@refreshtoken'); |
|
29 | + Route::post('first', 'UsersController@first'); |
|
30 | + Route::post('findby/{sortBy?}/{desc?}', 'UsersController@findby'); |
|
31 | + Route::post('paginateby/{perPage?}/{sortBy?}/{desc?}', 'UsersController@paginateby'); |
|
32 | + Route::post('save', 'UsersController@save'); |
|
33 | + Route::post('profile/save', 'UsersController@saveProfile'); |
|
34 | + Route::post('deleted/{perPage?}/{sortBy?}/{desc?}', 'UsersController@deleted'); |
|
35 | + Route::post('register', 'UsersController@register'); |
|
36 | + Route::post('login', 'UsersController@login'); |
|
37 | + Route::post('login/social', 'UsersController@loginSocial'); |
|
38 | + Route::post('assigngroups', 'UsersController@assigngroups'); |
|
39 | + Route::post('sendreset', 'UsersController@sendreset'); |
|
40 | + Route::post('resetpassword', 'UsersController@resetpassword'); |
|
41 | + Route::post('changepassword', 'UsersController@changePassword'); |
|
42 | + Route::post('confirm/email', 'UsersController@confirmEmail'); |
|
43 | + Route::post('resend/email/confirmation', 'UsersController@resendEmailConfirmation'); |
|
44 | + Route::post('group/{groupName}/{perPage?}/{sortBy?}/{desc?}', 'UsersController@group'); |
|
45 | + }); |
|
46 | 46 | |
47 | - Route::group(['prefix' => 'groups'], function () { |
|
47 | + Route::group(['prefix' => 'groups'], function () { |
|
48 | 48 | |
49 | - Route::get('list/{sortBy?}/{desc?}', 'GroupsController@index'); |
|
50 | - Route::get('find/{id}', 'GroupsController@find'); |
|
51 | - Route::get('search/{query?}/{perPage?}/{sortBy?}/{desc?}', 'GroupsController@search'); |
|
52 | - Route::get('paginate/{perPage?}/{sortBy?}/{desc?}', 'GroupsController@paginate'); |
|
53 | - Route::get('delete/{id}', 'GroupsController@delete'); |
|
54 | - Route::get('restore/{id}', 'GroupsController@restore'); |
|
55 | - Route::post('first', 'GroupsController@first'); |
|
56 | - Route::post('findby/{sortBy?}/{desc?}', 'GroupsController@findby'); |
|
57 | - Route::post('paginateby/{perPage?}/{sortBy?}/{desc?}', 'GroupsController@paginateby'); |
|
58 | - Route::post('save', 'GroupsController@save'); |
|
59 | - Route::post('deleted/{perPage?}/{sortBy?}/{desc?}', 'GroupsController@deleted'); |
|
60 | - Route::post('assignpermissions', 'GroupsController@assignpermissions'); |
|
61 | - }); |
|
49 | + Route::get('list/{sortBy?}/{desc?}', 'GroupsController@index'); |
|
50 | + Route::get('find/{id}', 'GroupsController@find'); |
|
51 | + Route::get('search/{query?}/{perPage?}/{sortBy?}/{desc?}', 'GroupsController@search'); |
|
52 | + Route::get('paginate/{perPage?}/{sortBy?}/{desc?}', 'GroupsController@paginate'); |
|
53 | + Route::get('delete/{id}', 'GroupsController@delete'); |
|
54 | + Route::get('restore/{id}', 'GroupsController@restore'); |
|
55 | + Route::post('first', 'GroupsController@first'); |
|
56 | + Route::post('findby/{sortBy?}/{desc?}', 'GroupsController@findby'); |
|
57 | + Route::post('paginateby/{perPage?}/{sortBy?}/{desc?}', 'GroupsController@paginateby'); |
|
58 | + Route::post('save', 'GroupsController@save'); |
|
59 | + Route::post('deleted/{perPage?}/{sortBy?}/{desc?}', 'GroupsController@deleted'); |
|
60 | + Route::post('assignpermissions', 'GroupsController@assignpermissions'); |
|
61 | + }); |
|
62 | 62 | |
63 | - Route::group(['prefix' => 'permissions'], function () { |
|
63 | + Route::group(['prefix' => 'permissions'], function () { |
|
64 | 64 | |
65 | - Route::get('list/{sortBy?}/{desc?}', 'PermissionsController@index'); |
|
66 | - Route::get('find/{id}', 'PermissionsController@find'); |
|
67 | - Route::get('search/{query?}/{perPage?}/{sortBy?}/{desc?}', 'PermissionsController@search'); |
|
68 | - Route::get('paginate/{perPage?}/{sortBy?}/{desc?}', 'PermissionsController@paginate'); |
|
69 | - Route::post('first', 'PermissionsController@first'); |
|
70 | - Route::post('findby/{sortBy?}/{desc?}', 'PermissionsController@findby'); |
|
71 | - Route::post('paginateby/{perPage?}/{sortBy?}/{desc?}', 'PermissionsController@paginateby'); |
|
72 | - }); |
|
65 | + Route::get('list/{sortBy?}/{desc?}', 'PermissionsController@index'); |
|
66 | + Route::get('find/{id}', 'PermissionsController@find'); |
|
67 | + Route::get('search/{query?}/{perPage?}/{sortBy?}/{desc?}', 'PermissionsController@search'); |
|
68 | + Route::get('paginate/{perPage?}/{sortBy?}/{desc?}', 'PermissionsController@paginate'); |
|
69 | + Route::post('first', 'PermissionsController@first'); |
|
70 | + Route::post('findby/{sortBy?}/{desc?}', 'PermissionsController@findby'); |
|
71 | + Route::post('paginateby/{perPage?}/{sortBy?}/{desc?}', 'PermissionsController@paginateby'); |
|
72 | + }); |
|
73 | 73 | |
74 | - Route::group(['prefix' => 'oauth/clients'], function () { |
|
74 | + Route::group(['prefix' => 'oauth/clients'], function () { |
|
75 | 75 | |
76 | - Route::get('list/{sortBy?}/{desc?}', 'OauthClientsController@index'); |
|
77 | - Route::get('find/{id}', 'OauthClientsController@find'); |
|
78 | - Route::get('search/{query?}/{perPage?}/{sortBy?}/{desc?}', 'OauthClientsController@search'); |
|
79 | - Route::get('paginate/{perPage?}/{sortBy?}/{desc?}', 'OauthClientsController@paginate'); |
|
80 | - Route::get('revoke/{id}', 'OauthClientsController@revoke'); |
|
81 | - Route::get('unrevoke/{id}', 'OauthClientsController@unRevoke'); |
|
82 | - Route::post('first', 'OauthClientsController@first'); |
|
83 | - Route::post('findby/{sortBy?}/{desc?}', 'OauthClientsController@findby'); |
|
84 | - Route::post('paginateby/{perPage?}/{sortBy?}/{desc?}', 'OauthClientsController@paginateby'); |
|
85 | - Route::post('save', 'OauthClientsController@save'); |
|
86 | - }); |
|
76 | + Route::get('list/{sortBy?}/{desc?}', 'OauthClientsController@index'); |
|
77 | + Route::get('find/{id}', 'OauthClientsController@find'); |
|
78 | + Route::get('search/{query?}/{perPage?}/{sortBy?}/{desc?}', 'OauthClientsController@search'); |
|
79 | + Route::get('paginate/{perPage?}/{sortBy?}/{desc?}', 'OauthClientsController@paginate'); |
|
80 | + Route::get('revoke/{id}', 'OauthClientsController@revoke'); |
|
81 | + Route::get('unrevoke/{id}', 'OauthClientsController@unRevoke'); |
|
82 | + Route::post('first', 'OauthClientsController@first'); |
|
83 | + Route::post('findby/{sortBy?}/{desc?}', 'OauthClientsController@findby'); |
|
84 | + Route::post('paginateby/{perPage?}/{sortBy?}/{desc?}', 'OauthClientsController@paginateby'); |
|
85 | + Route::post('save', 'OauthClientsController@save'); |
|
86 | + }); |
|
87 | 87 | }); |
@@ -6,53 +6,53 @@ |
||
6 | 6 | class AclPermissionObserver |
7 | 7 | { |
8 | 8 | |
9 | - public function saving($model) |
|
10 | - { |
|
11 | - // |
|
12 | - } |
|
13 | - |
|
14 | - public function saved($model) |
|
15 | - { |
|
16 | - // |
|
17 | - } |
|
18 | - |
|
19 | - public function creating($model) |
|
20 | - { |
|
21 | - // |
|
22 | - } |
|
23 | - |
|
24 | - public function created($model) |
|
25 | - { |
|
26 | - // |
|
27 | - } |
|
28 | - |
|
29 | - public function updating($model) |
|
30 | - { |
|
31 | - // |
|
32 | - } |
|
33 | - |
|
34 | - public function updated($model) |
|
35 | - { |
|
36 | - // |
|
37 | - } |
|
38 | - |
|
39 | - public function deleting($model) |
|
40 | - { |
|
41 | - // |
|
42 | - } |
|
43 | - |
|
44 | - public function deleted($model) |
|
45 | - { |
|
46 | - // |
|
47 | - } |
|
48 | - |
|
49 | - public function restoring($model) |
|
50 | - { |
|
51 | - // |
|
52 | - } |
|
53 | - |
|
54 | - public function restored($model) |
|
55 | - { |
|
56 | - // |
|
57 | - } |
|
9 | + public function saving($model) |
|
10 | + { |
|
11 | + // |
|
12 | + } |
|
13 | + |
|
14 | + public function saved($model) |
|
15 | + { |
|
16 | + // |
|
17 | + } |
|
18 | + |
|
19 | + public function creating($model) |
|
20 | + { |
|
21 | + // |
|
22 | + } |
|
23 | + |
|
24 | + public function created($model) |
|
25 | + { |
|
26 | + // |
|
27 | + } |
|
28 | + |
|
29 | + public function updating($model) |
|
30 | + { |
|
31 | + // |
|
32 | + } |
|
33 | + |
|
34 | + public function updated($model) |
|
35 | + { |
|
36 | + // |
|
37 | + } |
|
38 | + |
|
39 | + public function deleting($model) |
|
40 | + { |
|
41 | + // |
|
42 | + } |
|
43 | + |
|
44 | + public function deleted($model) |
|
45 | + { |
|
46 | + // |
|
47 | + } |
|
48 | + |
|
49 | + public function restoring($model) |
|
50 | + { |
|
51 | + // |
|
52 | + } |
|
53 | + |
|
54 | + public function restored($model) |
|
55 | + { |
|
56 | + // |
|
57 | + } |
|
58 | 58 | } |
@@ -6,69 +6,69 @@ |
||
6 | 6 | class AclGroupObserver |
7 | 7 | { |
8 | 8 | |
9 | - public function saving($model) |
|
10 | - { |
|
11 | - // |
|
12 | - } |
|
9 | + public function saving($model) |
|
10 | + { |
|
11 | + // |
|
12 | + } |
|
13 | 13 | |
14 | - public function saved($model) |
|
15 | - { |
|
16 | - // |
|
17 | - } |
|
14 | + public function saved($model) |
|
15 | + { |
|
16 | + // |
|
17 | + } |
|
18 | 18 | |
19 | - public function creating($model) |
|
20 | - { |
|
21 | - // |
|
22 | - } |
|
19 | + public function creating($model) |
|
20 | + { |
|
21 | + // |
|
22 | + } |
|
23 | 23 | |
24 | - public function created($model) |
|
25 | - { |
|
26 | - // |
|
27 | - } |
|
24 | + public function created($model) |
|
25 | + { |
|
26 | + // |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Prevent updating of the admin group. |
|
31 | - * |
|
32 | - * @param object $model the model beign updated. |
|
33 | - * @return void |
|
34 | - */ |
|
35 | - public function updating($model) |
|
36 | - { |
|
37 | - if ($model->getOriginal('name') == 'Admin') { |
|
38 | - \ErrorHandler::noPermissions(); |
|
39 | - } |
|
40 | - } |
|
29 | + /** |
|
30 | + * Prevent updating of the admin group. |
|
31 | + * |
|
32 | + * @param object $model the model beign updated. |
|
33 | + * @return void |
|
34 | + */ |
|
35 | + public function updating($model) |
|
36 | + { |
|
37 | + if ($model->getOriginal('name') == 'Admin') { |
|
38 | + \ErrorHandler::noPermissions(); |
|
39 | + } |
|
40 | + } |
|
41 | 41 | |
42 | - public function updated($model) |
|
43 | - { |
|
44 | - // |
|
45 | - } |
|
42 | + public function updated($model) |
|
43 | + { |
|
44 | + // |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Prevent deleting the admin group. |
|
49 | - * |
|
50 | - * @param object $model the delted model. |
|
51 | - * @return void |
|
52 | - */ |
|
53 | - public function deleting($model) |
|
54 | - { |
|
55 | - if ($model->getOriginal('name') == 'Admin') { |
|
56 | - \ErrorHandler::noPermissions(); |
|
57 | - } |
|
58 | - } |
|
47 | + /** |
|
48 | + * Prevent deleting the admin group. |
|
49 | + * |
|
50 | + * @param object $model the delted model. |
|
51 | + * @return void |
|
52 | + */ |
|
53 | + public function deleting($model) |
|
54 | + { |
|
55 | + if ($model->getOriginal('name') == 'Admin') { |
|
56 | + \ErrorHandler::noPermissions(); |
|
57 | + } |
|
58 | + } |
|
59 | 59 | |
60 | - public function deleted($model) |
|
61 | - { |
|
62 | - // |
|
63 | - } |
|
60 | + public function deleted($model) |
|
61 | + { |
|
62 | + // |
|
63 | + } |
|
64 | 64 | |
65 | - public function restoring($model) |
|
66 | - { |
|
67 | - // |
|
68 | - } |
|
65 | + public function restoring($model) |
|
66 | + { |
|
67 | + // |
|
68 | + } |
|
69 | 69 | |
70 | - public function restored($model) |
|
71 | - { |
|
72 | - // |
|
73 | - } |
|
70 | + public function restored($model) |
|
71 | + { |
|
72 | + // |
|
73 | + } |
|
74 | 74 | } |
@@ -8,53 +8,53 @@ |
||
8 | 8 | class OauthClientObserver |
9 | 9 | { |
10 | 10 | |
11 | - public function saving($model) |
|
12 | - { |
|
13 | - // |
|
14 | - } |
|
15 | - |
|
16 | - public function saved($model) |
|
17 | - { |
|
18 | - // |
|
19 | - } |
|
20 | - |
|
21 | - public function creating($model) |
|
22 | - { |
|
23 | - $model->secret = Str::random(40); |
|
24 | - } |
|
25 | - |
|
26 | - public function created($model) |
|
27 | - { |
|
28 | - // |
|
29 | - } |
|
30 | - |
|
31 | - public function updating($model) |
|
32 | - { |
|
33 | - // |
|
34 | - } |
|
35 | - |
|
36 | - public function updated($model) |
|
37 | - { |
|
38 | - // |
|
39 | - } |
|
40 | - |
|
41 | - public function deleting($model) |
|
42 | - { |
|
43 | - // |
|
44 | - } |
|
45 | - |
|
46 | - public function deleted($model) |
|
47 | - { |
|
48 | - // |
|
49 | - } |
|
50 | - |
|
51 | - public function restoring($model) |
|
52 | - { |
|
53 | - // |
|
54 | - } |
|
55 | - |
|
56 | - public function restored($model) |
|
57 | - { |
|
58 | - // |
|
59 | - } |
|
11 | + public function saving($model) |
|
12 | + { |
|
13 | + // |
|
14 | + } |
|
15 | + |
|
16 | + public function saved($model) |
|
17 | + { |
|
18 | + // |
|
19 | + } |
|
20 | + |
|
21 | + public function creating($model) |
|
22 | + { |
|
23 | + $model->secret = Str::random(40); |
|
24 | + } |
|
25 | + |
|
26 | + public function created($model) |
|
27 | + { |
|
28 | + // |
|
29 | + } |
|
30 | + |
|
31 | + public function updating($model) |
|
32 | + { |
|
33 | + // |
|
34 | + } |
|
35 | + |
|
36 | + public function updated($model) |
|
37 | + { |
|
38 | + // |
|
39 | + } |
|
40 | + |
|
41 | + public function deleting($model) |
|
42 | + { |
|
43 | + // |
|
44 | + } |
|
45 | + |
|
46 | + public function deleted($model) |
|
47 | + { |
|
48 | + // |
|
49 | + } |
|
50 | + |
|
51 | + public function restoring($model) |
|
52 | + { |
|
53 | + // |
|
54 | + } |
|
55 | + |
|
56 | + public function restored($model) |
|
57 | + { |
|
58 | + // |
|
59 | + } |
|
60 | 60 | } |
@@ -6,62 +6,62 @@ |
||
6 | 6 | class AclUserObserver |
7 | 7 | { |
8 | 8 | |
9 | - public function saving($model) |
|
10 | - { |
|
11 | - if ($model->isDirty('profile_picture')) { |
|
12 | - \Media::deleteImage($model->getOriginal('profile_picture')); |
|
13 | - } |
|
14 | - } |
|
9 | + public function saving($model) |
|
10 | + { |
|
11 | + if ($model->isDirty('profile_picture')) { |
|
12 | + \Media::deleteImage($model->getOriginal('profile_picture')); |
|
13 | + } |
|
14 | + } |
|
15 | 15 | |
16 | - public function saved($model) |
|
17 | - { |
|
18 | - // |
|
19 | - } |
|
16 | + public function saved($model) |
|
17 | + { |
|
18 | + // |
|
19 | + } |
|
20 | 20 | |
21 | - public function creating($model) |
|
22 | - { |
|
23 | - // |
|
24 | - } |
|
21 | + public function creating($model) |
|
22 | + { |
|
23 | + // |
|
24 | + } |
|
25 | 25 | |
26 | - public function created($model) |
|
27 | - { |
|
28 | - // |
|
29 | - } |
|
26 | + public function created($model) |
|
27 | + { |
|
28 | + // |
|
29 | + } |
|
30 | 30 | |
31 | - public function updating($model) |
|
32 | - { |
|
33 | - // |
|
34 | - } |
|
31 | + public function updating($model) |
|
32 | + { |
|
33 | + // |
|
34 | + } |
|
35 | 35 | |
36 | - public function updated($model) |
|
37 | - { |
|
38 | - if ($model->isDirty('blocked') && $model->blocked) { |
|
39 | - $model->tokens()->each(function ($token) { |
|
36 | + public function updated($model) |
|
37 | + { |
|
38 | + if ($model->isDirty('blocked') && $model->blocked) { |
|
39 | + $model->tokens()->each(function ($token) { |
|
40 | 40 | |
41 | - \Core::users()->revokeAccessToken($token); |
|
42 | - }); |
|
43 | - } |
|
44 | - } |
|
41 | + \Core::users()->revokeAccessToken($token); |
|
42 | + }); |
|
43 | + } |
|
44 | + } |
|
45 | 45 | |
46 | - public function deleting($model) |
|
47 | - { |
|
48 | - if ($model->getOriginal('id') == \Auth::id()) { |
|
49 | - \ErrorHandler::noPermissions(); |
|
50 | - } |
|
51 | - } |
|
46 | + public function deleting($model) |
|
47 | + { |
|
48 | + if ($model->getOriginal('id') == \Auth::id()) { |
|
49 | + \ErrorHandler::noPermissions(); |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - public function deleted($model) |
|
54 | - { |
|
55 | - // |
|
56 | - } |
|
53 | + public function deleted($model) |
|
54 | + { |
|
55 | + // |
|
56 | + } |
|
57 | 57 | |
58 | - public function restoring($model) |
|
59 | - { |
|
60 | - // |
|
61 | - } |
|
58 | + public function restoring($model) |
|
59 | + { |
|
60 | + // |
|
61 | + } |
|
62 | 62 | |
63 | - public function restored($model) |
|
64 | - { |
|
65 | - // |
|
66 | - } |
|
63 | + public function restored($model) |
|
64 | + { |
|
65 | + // |
|
66 | + } |
|
67 | 67 | } |
@@ -6,42 +6,42 @@ |
||
6 | 6 | class AclGroup extends Model |
7 | 7 | { |
8 | 8 | |
9 | - use SoftDeletes; |
|
10 | - protected $table = 'groups'; |
|
11 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
12 | - protected $hidden = ['deleted_at']; |
|
13 | - protected $guarded = ['id']; |
|
14 | - protected $fillable = ['name']; |
|
15 | - public $searchable = ['name']; |
|
16 | - |
|
17 | - public function getCreatedAtAttribute($value) |
|
18 | - { |
|
19 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
20 | - } |
|
21 | - |
|
22 | - public function getUpdatedAtAttribute($value) |
|
23 | - { |
|
24 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
25 | - } |
|
26 | - |
|
27 | - public function getDeletedAtAttribute($value) |
|
28 | - { |
|
29 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
30 | - } |
|
31 | - |
|
32 | - public function users() |
|
33 | - { |
|
34 | - return $this->belongsToMany('\App\Modules\Acl\AclUser', 'users_groups', 'group_id', 'user_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
35 | - } |
|
36 | - |
|
37 | - public function permissions() |
|
38 | - { |
|
39 | - return $this->belongsToMany('\App\Modules\Acl\AclPermission', 'groups_permissions', 'group_id', 'permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps(); |
|
40 | - } |
|
41 | - |
|
42 | - public static function boot() |
|
43 | - { |
|
44 | - parent::boot(); |
|
45 | - AclGroup::observe(\App::make('App\Modules\Acl\ModelObservers\AclGroupObserver')); |
|
46 | - } |
|
9 | + use SoftDeletes; |
|
10 | + protected $table = 'groups'; |
|
11 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
12 | + protected $hidden = ['deleted_at']; |
|
13 | + protected $guarded = ['id']; |
|
14 | + protected $fillable = ['name']; |
|
15 | + public $searchable = ['name']; |
|
16 | + |
|
17 | + public function getCreatedAtAttribute($value) |
|
18 | + { |
|
19 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
20 | + } |
|
21 | + |
|
22 | + public function getUpdatedAtAttribute($value) |
|
23 | + { |
|
24 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
25 | + } |
|
26 | + |
|
27 | + public function getDeletedAtAttribute($value) |
|
28 | + { |
|
29 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
30 | + } |
|
31 | + |
|
32 | + public function users() |
|
33 | + { |
|
34 | + return $this->belongsToMany('\App\Modules\Acl\AclUser', 'users_groups', 'group_id', 'user_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
35 | + } |
|
36 | + |
|
37 | + public function permissions() |
|
38 | + { |
|
39 | + return $this->belongsToMany('\App\Modules\Acl\AclPermission', 'groups_permissions', 'group_id', 'permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps(); |
|
40 | + } |
|
41 | + |
|
42 | + public static function boot() |
|
43 | + { |
|
44 | + parent::boot(); |
|
45 | + AclGroup::observe(\App::make('App\Modules\Acl\ModelObservers\AclGroupObserver')); |
|
46 | + } |
|
47 | 47 | } |
@@ -8,133 +8,133 @@ |
||
8 | 8 | class AclUser extends User |
9 | 9 | { |
10 | 10 | |
11 | - use SoftDeletes, HasApiTokens; |
|
12 | - protected $table = 'users'; |
|
13 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
14 | - protected $hidden = ['password', 'remember_token', 'deleted_at']; |
|
15 | - protected $guarded = ['id']; |
|
16 | - protected $fillable = ['profile_picture', 'name', 'email', 'password', 'locale', 'time_zone']; |
|
17 | - public $searchable = ['name', 'email']; |
|
11 | + use SoftDeletes, HasApiTokens; |
|
12 | + protected $table = 'users'; |
|
13 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
14 | + protected $hidden = ['password', 'remember_token', 'deleted_at']; |
|
15 | + protected $guarded = ['id']; |
|
16 | + protected $fillable = ['profile_picture', 'name', 'email', 'password', 'locale', 'time_zone']; |
|
17 | + public $searchable = ['name', 'email']; |
|
18 | 18 | |
19 | - public function getCreatedAtAttribute($value) |
|
20 | - { |
|
21 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
22 | - } |
|
23 | - |
|
24 | - public function getUpdatedAtAttribute($value) |
|
25 | - { |
|
26 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
27 | - } |
|
28 | - |
|
29 | - public function getDeletedAtAttribute($value) |
|
30 | - { |
|
31 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * Get the profile picture url. |
|
36 | - * @return string |
|
37 | - */ |
|
38 | - public function getProfilePictureAttribute($value) |
|
39 | - { |
|
40 | - return url(\Storage::url($value)); |
|
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * Encrypt the password attribute before |
|
45 | - * saving it in the storage. |
|
46 | - * |
|
47 | - * @param string $value |
|
48 | - */ |
|
49 | - public function setPasswordAttribute($value) |
|
50 | - { |
|
51 | - $this->attributes['password'] = bcrypt($value); |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Get the entity's notifications. |
|
56 | - */ |
|
57 | - public function notifications() |
|
58 | - { |
|
59 | - return $this->morphMany('\App\Modules\Notifications\Notification', 'notifiable')->orderBy('created_at', 'desc'); |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Get the entity's read notifications. |
|
64 | - */ |
|
65 | - public function readNotifications() |
|
66 | - { |
|
67 | - return $this->notifications()->whereNotNull('read_at'); |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Get the entity's unread notifications. |
|
72 | - */ |
|
73 | - public function unreadNotifications() |
|
74 | - { |
|
75 | - return $this->notifications()->whereNull('read_at'); |
|
76 | - } |
|
77 | - |
|
78 | - public function groups() |
|
79 | - { |
|
80 | - return $this->belongsToMany('\App\Modules\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
81 | - } |
|
82 | - |
|
83 | - public function oauthClients() |
|
84 | - { |
|
85 | - return $this->hasMany('App\Modules\Acl\OauthClient', 'user_id'); |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Return fcm device tokens that will be used in sending fcm notifications. |
|
90 | - * |
|
91 | - * @return array |
|
92 | - */ |
|
93 | - public function routeNotificationForFCM() |
|
94 | - { |
|
95 | - $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]); |
|
96 | - $tokens = []; |
|
97 | - |
|
98 | - foreach ($devices as $device) { |
|
99 | - if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) { |
|
100 | - $device->forceDelete(); |
|
101 | - continue; |
|
102 | - } |
|
103 | - |
|
104 | - $tokens[] = $device->device_token; |
|
105 | - } |
|
106 | - |
|
107 | - return $tokens; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * The channels the user receives notification broadcasts on. |
|
112 | - * |
|
113 | - * @return string |
|
114 | - */ |
|
115 | - public function receivesBroadcastNotificationsOn() |
|
116 | - { |
|
117 | - return 'users.'.$this->id; |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * Custom password validation. |
|
122 | - * |
|
123 | - * @param string $password |
|
124 | - * @return boolean |
|
125 | - */ |
|
126 | - public function validateForPassportPasswordGrant($password) |
|
127 | - { |
|
128 | - if ($password == config('skeleton.social_pass')) { |
|
129 | - return true; |
|
130 | - } |
|
131 | - |
|
132 | - return \Hash::check($password, $this->password); |
|
133 | - } |
|
19 | + public function getCreatedAtAttribute($value) |
|
20 | + { |
|
21 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
22 | + } |
|
23 | + |
|
24 | + public function getUpdatedAtAttribute($value) |
|
25 | + { |
|
26 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
27 | + } |
|
28 | + |
|
29 | + public function getDeletedAtAttribute($value) |
|
30 | + { |
|
31 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * Get the profile picture url. |
|
36 | + * @return string |
|
37 | + */ |
|
38 | + public function getProfilePictureAttribute($value) |
|
39 | + { |
|
40 | + return url(\Storage::url($value)); |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * Encrypt the password attribute before |
|
45 | + * saving it in the storage. |
|
46 | + * |
|
47 | + * @param string $value |
|
48 | + */ |
|
49 | + public function setPasswordAttribute($value) |
|
50 | + { |
|
51 | + $this->attributes['password'] = bcrypt($value); |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Get the entity's notifications. |
|
56 | + */ |
|
57 | + public function notifications() |
|
58 | + { |
|
59 | + return $this->morphMany('\App\Modules\Notifications\Notification', 'notifiable')->orderBy('created_at', 'desc'); |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Get the entity's read notifications. |
|
64 | + */ |
|
65 | + public function readNotifications() |
|
66 | + { |
|
67 | + return $this->notifications()->whereNotNull('read_at'); |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Get the entity's unread notifications. |
|
72 | + */ |
|
73 | + public function unreadNotifications() |
|
74 | + { |
|
75 | + return $this->notifications()->whereNull('read_at'); |
|
76 | + } |
|
77 | + |
|
78 | + public function groups() |
|
79 | + { |
|
80 | + return $this->belongsToMany('\App\Modules\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
81 | + } |
|
82 | + |
|
83 | + public function oauthClients() |
|
84 | + { |
|
85 | + return $this->hasMany('App\Modules\Acl\OauthClient', 'user_id'); |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Return fcm device tokens that will be used in sending fcm notifications. |
|
90 | + * |
|
91 | + * @return array |
|
92 | + */ |
|
93 | + public function routeNotificationForFCM() |
|
94 | + { |
|
95 | + $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]); |
|
96 | + $tokens = []; |
|
97 | + |
|
98 | + foreach ($devices as $device) { |
|
99 | + if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) { |
|
100 | + $device->forceDelete(); |
|
101 | + continue; |
|
102 | + } |
|
103 | + |
|
104 | + $tokens[] = $device->device_token; |
|
105 | + } |
|
106 | + |
|
107 | + return $tokens; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * The channels the user receives notification broadcasts on. |
|
112 | + * |
|
113 | + * @return string |
|
114 | + */ |
|
115 | + public function receivesBroadcastNotificationsOn() |
|
116 | + { |
|
117 | + return 'users.'.$this->id; |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * Custom password validation. |
|
122 | + * |
|
123 | + * @param string $password |
|
124 | + * @return boolean |
|
125 | + */ |
|
126 | + public function validateForPassportPasswordGrant($password) |
|
127 | + { |
|
128 | + if ($password == config('skeleton.social_pass')) { |
|
129 | + return true; |
|
130 | + } |
|
131 | + |
|
132 | + return \Hash::check($password, $this->password); |
|
133 | + } |
|
134 | 134 | |
135 | - public static function boot() |
|
136 | - { |
|
137 | - parent::boot(); |
|
138 | - AclUser::observe(\App::make('App\Modules\Acl\ModelObservers\AclUserObserver')); |
|
139 | - } |
|
135 | + public static function boot() |
|
136 | + { |
|
137 | + parent::boot(); |
|
138 | + AclUser::observe(\App::make('App\Modules\Acl\ModelObservers\AclUserObserver')); |
|
139 | + } |
|
140 | 140 | } |
@@ -6,37 +6,37 @@ |
||
6 | 6 | class AclPermission extends Model |
7 | 7 | { |
8 | 8 | |
9 | - use SoftDeletes; |
|
10 | - protected $table = 'permissions'; |
|
11 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
12 | - protected $hidden = ['deleted_at']; |
|
13 | - protected $guarded = ['id']; |
|
14 | - protected $fillable = ['name', 'model']; |
|
15 | - public $searchable = ['name', 'model']; |
|
9 | + use SoftDeletes; |
|
10 | + protected $table = 'permissions'; |
|
11 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
12 | + protected $hidden = ['deleted_at']; |
|
13 | + protected $guarded = ['id']; |
|
14 | + protected $fillable = ['name', 'model']; |
|
15 | + public $searchable = ['name', 'model']; |
|
16 | 16 | |
17 | - public function getCreatedAtAttribute($value) |
|
18 | - { |
|
19 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
20 | - } |
|
17 | + public function getCreatedAtAttribute($value) |
|
18 | + { |
|
19 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
20 | + } |
|
21 | 21 | |
22 | - public function getUpdatedAtAttribute($value) |
|
23 | - { |
|
24 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
25 | - } |
|
22 | + public function getUpdatedAtAttribute($value) |
|
23 | + { |
|
24 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
25 | + } |
|
26 | 26 | |
27 | - public function getDeletedAtAttribute($value) |
|
28 | - { |
|
29 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
30 | - } |
|
27 | + public function getDeletedAtAttribute($value) |
|
28 | + { |
|
29 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
30 | + } |
|
31 | 31 | |
32 | - public function groups() |
|
33 | - { |
|
34 | - return $this->belongsToMany('\App\Modules\Acl\AclGroup', 'groups_permissions', 'permission_id', 'group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps(); |
|
35 | - } |
|
32 | + public function groups() |
|
33 | + { |
|
34 | + return $this->belongsToMany('\App\Modules\Acl\AclGroup', 'groups_permissions', 'permission_id', 'group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps(); |
|
35 | + } |
|
36 | 36 | |
37 | - public static function boot() |
|
38 | - { |
|
39 | - parent::boot(); |
|
40 | - AclPermission::observe(\App::make('App\Modules\Acl\ModelObservers\AclPermissionObserver')); |
|
41 | - } |
|
37 | + public static function boot() |
|
38 | + { |
|
39 | + parent::boot(); |
|
40 | + AclPermission::observe(\App::make('App\Modules\Acl\ModelObservers\AclPermissionObserver')); |
|
41 | + } |
|
42 | 42 | } |
@@ -4,13 +4,13 @@ |
||
4 | 4 | |
5 | 5 | class PermissionRepository extends AbstractRepository |
6 | 6 | { |
7 | - /** |
|
8 | - * Return the model full namespace. |
|
9 | - * |
|
10 | - * @return string |
|
11 | - */ |
|
12 | - protected function getModel() |
|
13 | - { |
|
14 | - return 'App\Modules\Acl\AclPermission'; |
|
15 | - } |
|
7 | + /** |
|
8 | + * Return the model full namespace. |
|
9 | + * |
|
10 | + * @return string |
|
11 | + */ |
|
12 | + protected function getModel() |
|
13 | + { |
|
14 | + return 'App\Modules\Acl\AclPermission'; |
|
15 | + } |
|
16 | 16 | } |