@@ -7,31 +7,31 @@ |
||
| 7 | 7 | |
| 8 | 8 | class AuthServiceProvider extends ServiceProvider |
| 9 | 9 | {
|
| 10 | - /** |
|
| 11 | - * The policy mappings for the application. |
|
| 12 | - * |
|
| 13 | - * @var array |
|
| 14 | - */ |
|
| 15 | - protected $policies = [ |
|
| 16 | - 'App\Model' => 'App\Policies\ModelPolicy', |
|
| 17 | - ]; |
|
| 10 | + /** |
|
| 11 | + * The policy mappings for the application. |
|
| 12 | + * |
|
| 13 | + * @var array |
|
| 14 | + */ |
|
| 15 | + protected $policies = [ |
|
| 16 | + 'App\Model' => 'App\Policies\ModelPolicy', |
|
| 17 | + ]; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Register any authentication / authorization services. |
|
| 21 | - * |
|
| 22 | - * @return void |
|
| 23 | - */ |
|
| 24 | - public function boot() |
|
| 25 | - {
|
|
| 26 | - $this->registerPolicies(); |
|
| 19 | + /** |
|
| 20 | + * Register any authentication / authorization services. |
|
| 21 | + * |
|
| 22 | + * @return void |
|
| 23 | + */ |
|
| 24 | + public function boot() |
|
| 25 | + {
|
|
| 26 | + $this->registerPolicies(); |
|
| 27 | 27 | |
| 28 | - Passport::routes(function ($router) {
|
|
| 29 | - $router->forAuthorization(); |
|
| 30 | - $router->forAccessTokens(); |
|
| 31 | - $router->forPersonalAccessTokens(); |
|
| 32 | - $router->forTransientTokens(); |
|
| 33 | - }); |
|
| 34 | - Passport::tokensExpireIn(\Carbon\Carbon::now()->addMinutes(10)); |
|
| 35 | - Passport::refreshTokensExpireIn(\Carbon\Carbon::now()->addDays(10)); |
|
| 36 | - } |
|
| 28 | + Passport::routes(function ($router) {
|
|
| 29 | + $router->forAuthorization(); |
|
| 30 | + $router->forAccessTokens(); |
|
| 31 | + $router->forPersonalAccessTokens(); |
|
| 32 | + $router->forTransientTokens(); |
|
| 33 | + }); |
|
| 34 | + Passport::tokensExpireIn(\Carbon\Carbon::now()->addMinutes(10)); |
|
| 35 | + Passport::refreshTokensExpireIn(\Carbon\Carbon::now()->addDays(10)); |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | {
|
| 26 | 26 | $this->registerPolicies(); |
| 27 | 27 | |
| 28 | - Passport::routes(function ($router) {
|
|
| 28 | + Passport::routes(function($router) {
|
|
| 29 | 29 | $router->forAuthorization(); |
| 30 | 30 | $router->forAccessTokens(); |
| 31 | 31 | $router->forPersonalAccessTokens(); |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | 4 | |
| 5 | - /* |
|
| 5 | + /* |
|
| 6 | 6 | |-------------------------------------------------------------------------- |
| 7 | 7 | | Disable Confirm Email |
| 8 | 8 | |-------------------------------------------------------------------------- |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | - 'disable_confirm_email' => env('DISABLE_CONFIRM_EMAIL', false),
|
|
| 14 | + 'disable_confirm_email' => env('DISABLE_CONFIRM_EMAIL', false),
|
|
| 15 | 15 | |
| 16 | - /* |
|
| 16 | + /* |
|
| 17 | 17 | |-------------------------------------------------------------------------- |
| 18 | 18 | | Confirm Email URL |
| 19 | 19 | |-------------------------------------------------------------------------- |
@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | | |
| 23 | 23 | */ |
| 24 | 24 | |
| 25 | - 'confrim_email_url' => env('CONFIRM_EMAIL_URL'),
|
|
| 25 | + 'confrim_email_url' => env('CONFIRM_EMAIL_URL'),
|
|
| 26 | 26 | |
| 27 | - /* |
|
| 27 | + /* |
|
| 28 | 28 | |-------------------------------------------------------------------------- |
| 29 | 29 | | Reset Password URL |
| 30 | 30 | |-------------------------------------------------------------------------- |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | | |
| 34 | 34 | */ |
| 35 | 35 | |
| 36 | - 'reset_password_url' => env('RESET_PASSWORD_URL'),
|
|
| 36 | + 'reset_password_url' => env('RESET_PASSWORD_URL'),
|
|
| 37 | 37 | |
| 38 | - /* |
|
| 38 | + /* |
|
| 39 | 39 | |-------------------------------------------------------------------------- |
| 40 | 40 | | Passport Client Id |
| 41 | 41 | |-------------------------------------------------------------------------- |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | | |
| 45 | 45 | */ |
| 46 | 46 | |
| 47 | - 'passport_client_id' => env('PASSWORD_CLIENT_ID'),
|
|
| 47 | + 'passport_client_id' => env('PASSWORD_CLIENT_ID'),
|
|
| 48 | 48 | |
| 49 | - /* |
|
| 49 | + /* |
|
| 50 | 50 | |-------------------------------------------------------------------------- |
| 51 | 51 | | Passport Client Secret |
| 52 | 52 | |-------------------------------------------------------------------------- |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | | |
| 56 | 56 | */ |
| 57 | 57 | |
| 58 | - 'passport_client_secret' => env('PASSWORD_CLIENT_SECRET'),
|
|
| 58 | + 'passport_client_secret' => env('PASSWORD_CLIENT_SECRET'),
|
|
| 59 | 59 | |
| 60 | - /* |
|
| 60 | + /* |
|
| 61 | 61 | |-------------------------------------------------------------------------- |
| 62 | 62 | | Social Pass |
| 63 | 63 | |-------------------------------------------------------------------------- |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | | |
| 67 | 67 | */ |
| 68 | 68 | |
| 69 | - 'social_pass' => env('SOCIAL_PASS', false),
|
|
| 69 | + 'social_pass' => env('SOCIAL_PASS', false),
|
|
| 70 | 70 | |
| 71 | - /* |
|
| 71 | + /* |
|
| 72 | 72 | |-------------------------------------------------------------------------- |
| 73 | 73 | | Relations Between Models |
| 74 | 74 | |-------------------------------------------------------------------------- |
@@ -77,88 +77,88 @@ discard block |
||
| 77 | 77 | | |
| 78 | 78 | */ |
| 79 | 79 | |
| 80 | - 'relations' => [ |
|
| 81 | - 'user' => [ |
|
| 82 | - 'list' => [], |
|
| 83 | - 'find' => [], |
|
| 84 | - 'findby' => [], |
|
| 85 | - 'paginate' => [], |
|
| 86 | - 'paginateby' => [], |
|
| 87 | - 'first' => [], |
|
| 88 | - 'search' => [], |
|
| 89 | - 'account' => [], |
|
| 90 | - 'group' => [], |
|
| 91 | - 'deleted' => [], |
|
| 92 | - ], |
|
| 93 | - 'permission' => [ |
|
| 94 | - 'list' => [], |
|
| 95 | - 'find' => [], |
|
| 96 | - 'findby' => [], |
|
| 97 | - 'paginate' => [], |
|
| 98 | - 'paginateby' => [], |
|
| 99 | - 'first' => [], |
|
| 100 | - 'search' => [], |
|
| 101 | - 'deleted' => [], |
|
| 102 | - ], |
|
| 103 | - 'group' => [ |
|
| 104 | - 'list' => [], |
|
| 105 | - 'find' => [], |
|
| 106 | - 'findby' => [], |
|
| 107 | - 'paginate' => [], |
|
| 108 | - 'paginateby' => [], |
|
| 109 | - 'first' => [], |
|
| 110 | - 'search' => [], |
|
| 111 | - 'deleted' => [], |
|
| 112 | - ], |
|
| 113 | - 'oauthClient' => [ |
|
| 114 | - 'list' => [], |
|
| 115 | - 'find' => [], |
|
| 116 | - 'findby' => [], |
|
| 117 | - 'paginate' => [], |
|
| 118 | - 'paginateby' => [], |
|
| 119 | - 'first' => [], |
|
| 120 | - 'search' => [], |
|
| 121 | - 'account' => [], |
|
| 122 | - 'group' => [], |
|
| 123 | - 'deleted' => [], |
|
| 124 | - ], |
|
| 125 | - 'notification' => [ |
|
| 126 | - 'list' => [], |
|
| 127 | - 'unread' => [], |
|
| 128 | - ], |
|
| 129 | - 'pushNotificationDevice' => [ |
|
| 130 | - 'list' => [], |
|
| 131 | - 'find' => [], |
|
| 132 | - 'findby' => [], |
|
| 133 | - 'paginate' => [], |
|
| 134 | - 'paginateby' => [], |
|
| 135 | - 'first' => [], |
|
| 136 | - 'search' => [], |
|
| 137 | - 'deleted' => [], |
|
| 138 | - ], |
|
| 139 | - 'report' => [ |
|
| 140 | - 'list' => [], |
|
| 141 | - 'find' => [], |
|
| 142 | - 'findby' => [], |
|
| 143 | - 'paginate' => [], |
|
| 144 | - 'paginateby' => [], |
|
| 145 | - 'first' => [], |
|
| 146 | - 'search' => [], |
|
| 147 | - 'deleted' => [], |
|
| 148 | - ], |
|
| 149 | - 'setting' => [ |
|
| 150 | - 'list' => [], |
|
| 151 | - 'find' => [], |
|
| 152 | - 'findby' => [], |
|
| 153 | - 'paginate' => [], |
|
| 154 | - 'paginateby' => [], |
|
| 155 | - 'first' => [], |
|
| 156 | - 'search' => [], |
|
| 157 | - 'deleted' => [], |
|
| 158 | - ] |
|
| 159 | - ], |
|
| 80 | + 'relations' => [ |
|
| 81 | + 'user' => [ |
|
| 82 | + 'list' => [], |
|
| 83 | + 'find' => [], |
|
| 84 | + 'findby' => [], |
|
| 85 | + 'paginate' => [], |
|
| 86 | + 'paginateby' => [], |
|
| 87 | + 'first' => [], |
|
| 88 | + 'search' => [], |
|
| 89 | + 'account' => [], |
|
| 90 | + 'group' => [], |
|
| 91 | + 'deleted' => [], |
|
| 92 | + ], |
|
| 93 | + 'permission' => [ |
|
| 94 | + 'list' => [], |
|
| 95 | + 'find' => [], |
|
| 96 | + 'findby' => [], |
|
| 97 | + 'paginate' => [], |
|
| 98 | + 'paginateby' => [], |
|
| 99 | + 'first' => [], |
|
| 100 | + 'search' => [], |
|
| 101 | + 'deleted' => [], |
|
| 102 | + ], |
|
| 103 | + 'group' => [ |
|
| 104 | + 'list' => [], |
|
| 105 | + 'find' => [], |
|
| 106 | + 'findby' => [], |
|
| 107 | + 'paginate' => [], |
|
| 108 | + 'paginateby' => [], |
|
| 109 | + 'first' => [], |
|
| 110 | + 'search' => [], |
|
| 111 | + 'deleted' => [], |
|
| 112 | + ], |
|
| 113 | + 'oauthClient' => [ |
|
| 114 | + 'list' => [], |
|
| 115 | + 'find' => [], |
|
| 116 | + 'findby' => [], |
|
| 117 | + 'paginate' => [], |
|
| 118 | + 'paginateby' => [], |
|
| 119 | + 'first' => [], |
|
| 120 | + 'search' => [], |
|
| 121 | + 'account' => [], |
|
| 122 | + 'group' => [], |
|
| 123 | + 'deleted' => [], |
|
| 124 | + ], |
|
| 125 | + 'notification' => [ |
|
| 126 | + 'list' => [], |
|
| 127 | + 'unread' => [], |
|
| 128 | + ], |
|
| 129 | + 'pushNotificationDevice' => [ |
|
| 130 | + 'list' => [], |
|
| 131 | + 'find' => [], |
|
| 132 | + 'findby' => [], |
|
| 133 | + 'paginate' => [], |
|
| 134 | + 'paginateby' => [], |
|
| 135 | + 'first' => [], |
|
| 136 | + 'search' => [], |
|
| 137 | + 'deleted' => [], |
|
| 138 | + ], |
|
| 139 | + 'report' => [ |
|
| 140 | + 'list' => [], |
|
| 141 | + 'find' => [], |
|
| 142 | + 'findby' => [], |
|
| 143 | + 'paginate' => [], |
|
| 144 | + 'paginateby' => [], |
|
| 145 | + 'first' => [], |
|
| 146 | + 'search' => [], |
|
| 147 | + 'deleted' => [], |
|
| 148 | + ], |
|
| 149 | + 'setting' => [ |
|
| 150 | + 'list' => [], |
|
| 151 | + 'find' => [], |
|
| 152 | + 'findby' => [], |
|
| 153 | + 'paginate' => [], |
|
| 154 | + 'paginateby' => [], |
|
| 155 | + 'first' => [], |
|
| 156 | + 'search' => [], |
|
| 157 | + 'deleted' => [], |
|
| 158 | + ] |
|
| 159 | + ], |
|
| 160 | 160 | |
| 161 | - /* |
|
| 161 | + /* |
|
| 162 | 162 | |-------------------------------------------------------------------------- |
| 163 | 163 | | Cache Configurations |
| 164 | 164 | |-------------------------------------------------------------------------- |
@@ -167,46 +167,46 @@ discard block |
||
| 167 | 167 | | |
| 168 | 168 | */ |
| 169 | 169 | |
| 170 | - 'cache_config' => [ |
|
| 171 | - 'oauthClient' => [ |
|
| 172 | - 'cache' => [ |
|
| 173 | - 'all', |
|
| 174 | - 'find', |
|
| 175 | - 'findBy', |
|
| 176 | - 'paginate', |
|
| 177 | - 'paginateBy', |
|
| 178 | - 'first', |
|
| 179 | - 'search', |
|
| 180 | - 'deleted' |
|
| 181 | - ], |
|
| 182 | - 'clear' => [ |
|
| 183 | - 'update' => ['oauthClients', 'users', 'groups'], |
|
| 184 | - 'save' => ['oauthClients', 'users', 'groups'], |
|
| 185 | - 'delete' => ['oauthClients', 'users', 'groups'], |
|
| 186 | - 'restore' => ['oauthClients', 'users', 'groups'], |
|
| 187 | - 'revoke' => ['oauthClients', 'users', 'groups'], |
|
| 188 | - 'ubRevoke' => ['oauthClients', 'users', 'groups'], |
|
| 189 | - 'regenerateSecret' => ['oauthClients', 'users', 'groups'], |
|
| 190 | - ], |
|
| 191 | - ], |
|
| 192 | - 'setting' => [ |
|
| 193 | - 'cache' => [ |
|
| 194 | - 'all', |
|
| 195 | - 'find', |
|
| 196 | - 'findBy', |
|
| 197 | - 'paginate', |
|
| 198 | - 'paginateBy', |
|
| 199 | - 'first', |
|
| 200 | - 'search', |
|
| 201 | - 'deleted' |
|
| 202 | - ], |
|
| 203 | - 'clear' => [ |
|
| 204 | - 'update' => ['settings'], |
|
| 205 | - 'save' => ['settings'], |
|
| 206 | - 'delete' => ['settings'], |
|
| 207 | - 'restore' => ['settings'], |
|
| 208 | - 'saveMany' => ['settings'], |
|
| 209 | - ] |
|
| 210 | - ] |
|
| 211 | - ] |
|
| 170 | + 'cache_config' => [ |
|
| 171 | + 'oauthClient' => [ |
|
| 172 | + 'cache' => [ |
|
| 173 | + 'all', |
|
| 174 | + 'find', |
|
| 175 | + 'findBy', |
|
| 176 | + 'paginate', |
|
| 177 | + 'paginateBy', |
|
| 178 | + 'first', |
|
| 179 | + 'search', |
|
| 180 | + 'deleted' |
|
| 181 | + ], |
|
| 182 | + 'clear' => [ |
|
| 183 | + 'update' => ['oauthClients', 'users', 'groups'], |
|
| 184 | + 'save' => ['oauthClients', 'users', 'groups'], |
|
| 185 | + 'delete' => ['oauthClients', 'users', 'groups'], |
|
| 186 | + 'restore' => ['oauthClients', 'users', 'groups'], |
|
| 187 | + 'revoke' => ['oauthClients', 'users', 'groups'], |
|
| 188 | + 'ubRevoke' => ['oauthClients', 'users', 'groups'], |
|
| 189 | + 'regenerateSecret' => ['oauthClients', 'users', 'groups'], |
|
| 190 | + ], |
|
| 191 | + ], |
|
| 192 | + 'setting' => [ |
|
| 193 | + 'cache' => [ |
|
| 194 | + 'all', |
|
| 195 | + 'find', |
|
| 196 | + 'findBy', |
|
| 197 | + 'paginate', |
|
| 198 | + 'paginateBy', |
|
| 199 | + 'first', |
|
| 200 | + 'search', |
|
| 201 | + 'deleted' |
|
| 202 | + ], |
|
| 203 | + 'clear' => [ |
|
| 204 | + 'update' => ['settings'], |
|
| 205 | + 'save' => ['settings'], |
|
| 206 | + 'delete' => ['settings'], |
|
| 207 | + 'restore' => ['settings'], |
|
| 208 | + 'saveMany' => ['settings'], |
|
| 209 | + ] |
|
| 210 | + ] |
|
| 211 | + ] |
|
| 212 | 212 | ]; |
@@ -11,68 +11,68 @@ |
||
| 11 | 11 | |
| 12 | 12 | class CheckPermissions |
| 13 | 13 | { |
| 14 | - protected $route; |
|
| 15 | - protected $auth; |
|
| 16 | - protected $authMiddleware; |
|
| 17 | - protected $userService; |
|
| 18 | - protected $arr; |
|
| 14 | + protected $route; |
|
| 15 | + protected $auth; |
|
| 16 | + protected $authMiddleware; |
|
| 17 | + protected $userService; |
|
| 18 | + protected $arr; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Init new object. |
|
| 22 | - * |
|
| 23 | - * @param Route $route |
|
| 24 | - * @param Auth $auth |
|
| 25 | - * @param AuthMiddleware $authMiddleware |
|
| 26 | - * @param UserService $userService |
|
| 27 | - * @param Arr $arr |
|
| 28 | - * |
|
| 29 | - * @return void |
|
| 30 | - */ |
|
| 31 | - public function __construct(Route $route, Auth $auth, AuthMiddleware $authMiddleware, UserService $userService, Arr $arr) |
|
| 32 | - { |
|
| 33 | - $this->route = $route; |
|
| 34 | - $this->auth = $auth; |
|
| 35 | - $this->authMiddleware = $authMiddleware; |
|
| 36 | - $this->userService = $userService; |
|
| 37 | - $this->arr = $arr; |
|
| 38 | - } |
|
| 20 | + /** |
|
| 21 | + * Init new object. |
|
| 22 | + * |
|
| 23 | + * @param Route $route |
|
| 24 | + * @param Auth $auth |
|
| 25 | + * @param AuthMiddleware $authMiddleware |
|
| 26 | + * @param UserService $userService |
|
| 27 | + * @param Arr $arr |
|
| 28 | + * |
|
| 29 | + * @return void |
|
| 30 | + */ |
|
| 31 | + public function __construct(Route $route, Auth $auth, AuthMiddleware $authMiddleware, UserService $userService, Arr $arr) |
|
| 32 | + { |
|
| 33 | + $this->route = $route; |
|
| 34 | + $this->auth = $auth; |
|
| 35 | + $this->authMiddleware = $authMiddleware; |
|
| 36 | + $this->userService = $userService; |
|
| 37 | + $this->arr = $arr; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Handle an incoming request. |
|
| 42 | - * |
|
| 43 | - * @param \Illuminate\Http\Request $request |
|
| 44 | - * @param \Closure $next |
|
| 45 | - * @return mixed |
|
| 46 | - */ |
|
| 47 | - public function handle($request, Closure $next) |
|
| 48 | - { |
|
| 49 | - $routeActions = explode('@', $this->route->currentRouteAction()); |
|
| 50 | - $reflectionClass = new \ReflectionClass($routeActions[0]); |
|
| 51 | - $classProperties = $reflectionClass->getDefaultProperties(); |
|
| 52 | - $skipPermissionCheck = $this->arr->get($classProperties, 'skipPermissionCheck', []); |
|
| 53 | - $skipLoginCheck = $this->arr->get($classProperties, 'skipLoginCheck', []); |
|
| 54 | - $modelName = explode('\\', $routeActions[0]); |
|
| 55 | - $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
| 56 | - $permission = $routeActions[1]; |
|
| 40 | + /** |
|
| 41 | + * Handle an incoming request. |
|
| 42 | + * |
|
| 43 | + * @param \Illuminate\Http\Request $request |
|
| 44 | + * @param \Closure $next |
|
| 45 | + * @return mixed |
|
| 46 | + */ |
|
| 47 | + public function handle($request, Closure $next) |
|
| 48 | + { |
|
| 49 | + $routeActions = explode('@', $this->route->currentRouteAction()); |
|
| 50 | + $reflectionClass = new \ReflectionClass($routeActions[0]); |
|
| 51 | + $classProperties = $reflectionClass->getDefaultProperties(); |
|
| 52 | + $skipPermissionCheck = $this->arr->get($classProperties, 'skipPermissionCheck', []); |
|
| 53 | + $skipLoginCheck = $this->arr->get($classProperties, 'skipLoginCheck', []); |
|
| 54 | + $modelName = explode('\\', $routeActions[0]); |
|
| 55 | + $modelName = lcfirst(str_replace('Controller', '', end($modelName))); |
|
| 56 | + $permission = $routeActions[1]; |
|
| 57 | 57 | |
| 58 | - $this->auth->shouldUse('api'); |
|
| 59 | - if (! in_array($permission, $skipLoginCheck)) { |
|
| 60 | - $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $skipLoginCheck, $permission) { |
|
| 61 | - $user = $this->auth->user(); |
|
| 62 | - $isPasswordClient = $user->token()->client->password_client; |
|
| 58 | + $this->auth->shouldUse('api'); |
|
| 59 | + if (! in_array($permission, $skipLoginCheck)) { |
|
| 60 | + $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $skipLoginCheck, $permission) { |
|
| 61 | + $user = $this->auth->user(); |
|
| 62 | + $isPasswordClient = $user->token()->client->password_client; |
|
| 63 | 63 | |
| 64 | - if ($user->blocked) { |
|
| 65 | - \Errors::userIsBlocked(); |
|
| 66 | - } |
|
| 64 | + if ($user->blocked) { |
|
| 65 | + \Errors::userIsBlocked(); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) { |
|
| 69 | - } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
| 70 | - } else { |
|
| 71 | - \Errors::noPermissions(); |
|
| 72 | - } |
|
| 73 | - }); |
|
| 74 | - } |
|
| 68 | + if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) { |
|
| 69 | + } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
| 70 | + } else { |
|
| 71 | + \Errors::noPermissions(); |
|
| 72 | + } |
|
| 73 | + }); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return $next($request); |
|
| 77 | - } |
|
| 76 | + return $next($request); |
|
| 77 | + } |
|
| 78 | 78 | } |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | $permission = $routeActions[1]; |
| 57 | 57 | |
| 58 | 58 | $this->auth->shouldUse('api'); |
| 59 | - if (! in_array($permission, $skipLoginCheck)) { |
|
| 60 | - $this->authMiddleware->handle($request, function ($request) use ($modelName, $skipPermissionCheck, $skipLoginCheck, $permission) { |
|
| 59 | + if ( ! in_array($permission, $skipLoginCheck)) { |
|
| 60 | + $this->authMiddleware->handle($request, function($request) use ($modelName, $skipPermissionCheck, $skipLoginCheck, $permission) { |
|
| 61 | 61 | $user = $this->auth->user(); |
| 62 | 62 | $isPasswordClient = $user->token()->client->password_client; |
| 63 | 63 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | if ($isPasswordClient && (in_array($permission, $skipPermissionCheck) || $this->userService->can($permission, $modelName))) { |
| 69 | - } elseif (! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
| 69 | + } elseif ( ! $isPasswordClient && $user->tokenCan($modelName.'-'.$permission)) { |
|
| 70 | 70 | } else { |
| 71 | 71 | \Errors::noPermissions(); |
| 72 | 72 | } |
@@ -5,14 +5,14 @@ |
||
| 5 | 5 | |
| 6 | 6 | class DummyService extends BaseService |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Init new object. |
|
| 10 | - * |
|
| 11 | - * @param DummyRepository $repo |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function __construct(DummyRepository $repo) |
|
| 15 | - { |
|
| 16 | - parent::__construct($repo); |
|
| 17 | - } |
|
| 8 | + /** |
|
| 9 | + * Init new object. |
|
| 10 | + * |
|
| 11 | + * @param DummyRepository $repo |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function __construct(DummyRepository $repo) |
|
| 15 | + { |
|
| 16 | + parent::__construct($repo); |
|
| 17 | + } |
|
| 18 | 18 | } |
@@ -6,67 +6,67 @@ |
||
| 6 | 6 | class SettingsObserver |
| 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 | - /** |
|
| 20 | - * Prevent the creating of the settings. |
|
| 21 | - * |
|
| 22 | - * @param object $model the model beign created. |
|
| 23 | - * @return void |
|
| 24 | - */ |
|
| 25 | - public function creating($model) |
|
| 26 | - { |
|
| 27 | - \Errors::cannotCreateSetting(); |
|
| 28 | - } |
|
| 19 | + /** |
|
| 20 | + * Prevent the creating of the settings. |
|
| 21 | + * |
|
| 22 | + * @param object $model the model beign created. |
|
| 23 | + * @return void |
|
| 24 | + */ |
|
| 25 | + public function creating($model) |
|
| 26 | + { |
|
| 27 | + \Errors::cannotCreateSetting(); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public function created($model) |
|
| 31 | - { |
|
| 32 | - // |
|
| 33 | - } |
|
| 30 | + public function created($model) |
|
| 31 | + { |
|
| 32 | + // |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Prevent updating of the setting key. |
|
| 37 | - * |
|
| 38 | - * @param object $model the model beign updated. |
|
| 39 | - * @return void |
|
| 40 | - */ |
|
| 41 | - public function updating($model) |
|
| 42 | - { |
|
| 43 | - if ($model->getOriginal('key') !== $model->key) { |
|
| 44 | - \Errors::cannotUpdateSettingKey(); |
|
| 45 | - } |
|
| 46 | - } |
|
| 35 | + /** |
|
| 36 | + * Prevent updating of the setting key. |
|
| 37 | + * |
|
| 38 | + * @param object $model the model beign updated. |
|
| 39 | + * @return void |
|
| 40 | + */ |
|
| 41 | + public function updating($model) |
|
| 42 | + { |
|
| 43 | + if ($model->getOriginal('key') !== $model->key) { |
|
| 44 | + \Errors::cannotUpdateSettingKey(); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - public function updated($model) |
|
| 49 | - { |
|
| 50 | - // |
|
| 51 | - } |
|
| 48 | + public function updated($model) |
|
| 49 | + { |
|
| 50 | + // |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - public function deleting($model) |
|
| 54 | - { |
|
| 55 | - // |
|
| 56 | - } |
|
| 53 | + public function deleting($model) |
|
| 54 | + { |
|
| 55 | + // |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public function deleted($model) |
|
| 59 | - { |
|
| 60 | - // |
|
| 61 | - } |
|
| 58 | + public function deleted($model) |
|
| 59 | + { |
|
| 60 | + // |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - public function restoring($model) |
|
| 64 | - { |
|
| 65 | - // |
|
| 66 | - } |
|
| 63 | + public function restoring($model) |
|
| 64 | + { |
|
| 65 | + // |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - public function restored($model) |
|
| 69 | - { |
|
| 70 | - // |
|
| 71 | - } |
|
| 68 | + public function restored($model) |
|
| 69 | + { |
|
| 70 | + // |
|
| 71 | + } |
|
| 72 | 72 | } |
@@ -5,102 +5,102 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CachingDecorator |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * @var string |
|
| 10 | - */ |
|
| 11 | - public $repo; |
|
| 8 | + /** |
|
| 9 | + * @var string |
|
| 10 | + */ |
|
| 11 | + public $repo; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * @var Cache |
|
| 15 | - */ |
|
| 16 | - protected $cache; |
|
| 13 | + /** |
|
| 14 | + * @var Cache |
|
| 15 | + */ |
|
| 16 | + protected $cache; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @var string |
|
| 20 | - */ |
|
| 21 | - public $modelKey; |
|
| 18 | + /** |
|
| 19 | + * @var string |
|
| 20 | + */ |
|
| 21 | + public $modelKey; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @var string |
|
| 25 | - */ |
|
| 26 | - public $model; |
|
| 23 | + /** |
|
| 24 | + * @var string |
|
| 25 | + */ |
|
| 26 | + public $model; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var string |
|
| 30 | - */ |
|
| 31 | - public $modelClass; |
|
| 28 | + /** |
|
| 29 | + * @var string |
|
| 30 | + */ |
|
| 31 | + public $modelClass; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var mixed |
|
| 35 | - */ |
|
| 36 | - public $cacheConfig; |
|
| 33 | + /** |
|
| 34 | + * @var mixed |
|
| 35 | + */ |
|
| 36 | + public $cacheConfig; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @var string |
|
| 40 | - */ |
|
| 41 | - public $cacheTag; |
|
| 38 | + /** |
|
| 39 | + * @var string |
|
| 40 | + */ |
|
| 41 | + public $cacheTag; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Init new object. |
|
| 45 | - * |
|
| 46 | - * @param string $repo |
|
| 47 | - * @param Cache $cache |
|
| 48 | - * |
|
| 49 | - * @return void |
|
| 50 | - */ |
|
| 51 | - public function __construct($repo, Cache $cache) |
|
| 52 | - { |
|
| 53 | - $this->repo = $repo; |
|
| 54 | - $this->cache = $cache; |
|
| 55 | - $this->model = $this->repo->model; |
|
| 56 | - $this->modelClass = get_class($this->model); |
|
| 57 | - $repoClass = explode('\\', get_class($this->repo)); |
|
| 58 | - $repoName = end($repoClass); |
|
| 59 | - $this->cacheTag = lcfirst(substr($repoName, 0, strpos($repoName, 'Repository'))); |
|
| 60 | - } |
|
| 43 | + /** |
|
| 44 | + * Init new object. |
|
| 45 | + * |
|
| 46 | + * @param string $repo |
|
| 47 | + * @param Cache $cache |
|
| 48 | + * |
|
| 49 | + * @return void |
|
| 50 | + */ |
|
| 51 | + public function __construct($repo, Cache $cache) |
|
| 52 | + { |
|
| 53 | + $this->repo = $repo; |
|
| 54 | + $this->cache = $cache; |
|
| 55 | + $this->model = $this->repo->model; |
|
| 56 | + $this->modelClass = get_class($this->model); |
|
| 57 | + $repoClass = explode('\\', get_class($this->repo)); |
|
| 58 | + $repoName = end($repoClass); |
|
| 59 | + $this->cacheTag = lcfirst(substr($repoName, 0, strpos($repoName, 'Repository'))); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Handle the cache mechanism for the called method |
|
| 64 | - * based the configurations. |
|
| 65 | - * |
|
| 66 | - * @param string $name the called method name |
|
| 67 | - * @param array $arguments the method arguments |
|
| 68 | - * @return object |
|
| 69 | - */ |
|
| 70 | - public function __call($name, $arguments) |
|
| 71 | - { |
|
| 72 | - $this->setCacheConfig($name); |
|
| 62 | + /** |
|
| 63 | + * Handle the cache mechanism for the called method |
|
| 64 | + * based the configurations. |
|
| 65 | + * |
|
| 66 | + * @param string $name the called method name |
|
| 67 | + * @param array $arguments the method arguments |
|
| 68 | + * @return object |
|
| 69 | + */ |
|
| 70 | + public function __call($name, $arguments) |
|
| 71 | + { |
|
| 72 | + $this->setCacheConfig($name); |
|
| 73 | 73 | |
| 74 | - if ($this->cacheConfig && $this->cacheConfig == 'cache') { |
|
| 75 | - $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
|
| 76 | - $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
|
| 77 | - return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function () use ($arguments, $name) { |
|
| 78 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 79 | - }); |
|
| 80 | - } elseif ($this->cacheConfig && $this->cacheConfig == 'clear') { |
|
| 81 | - $this->cache->tags($this->cacheConfig)->flush(); |
|
| 82 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 83 | - } |
|
| 74 | + if ($this->cacheConfig && $this->cacheConfig == 'cache') { |
|
| 75 | + $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
|
| 76 | + $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
|
| 77 | + return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function () use ($arguments, $name) { |
|
| 78 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 79 | + }); |
|
| 80 | + } elseif ($this->cacheConfig && $this->cacheConfig == 'clear') { |
|
| 81 | + $this->cache->tags($this->cacheConfig)->flush(); |
|
| 82 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 86 | - } |
|
| 85 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Set cache config based on the called method. |
|
| 90 | - * |
|
| 91 | - * @param string $name |
|
| 92 | - * @return void |
|
| 93 | - */ |
|
| 94 | - private function setCacheConfig($name) |
|
| 95 | - { |
|
| 96 | - $config = \CoreConfig::getConfig(); |
|
| 97 | - $cacheConfig = Arr::get($config['cacheConfig'], $this->cacheTag, false); |
|
| 98 | - $this->cacheConfig = false; |
|
| 88 | + /** |
|
| 89 | + * Set cache config based on the called method. |
|
| 90 | + * |
|
| 91 | + * @param string $name |
|
| 92 | + * @return void |
|
| 93 | + */ |
|
| 94 | + private function setCacheConfig($name) |
|
| 95 | + { |
|
| 96 | + $config = \CoreConfig::getConfig(); |
|
| 97 | + $cacheConfig = Arr::get($config['cacheConfig'], $this->cacheTag, false); |
|
| 98 | + $this->cacheConfig = false; |
|
| 99 | 99 | |
| 100 | - if ($cacheConfig && in_array($name, $cacheConfig['cache'])) { |
|
| 101 | - $this->cacheConfig = 'cache'; |
|
| 102 | - } elseif ($cacheConfig && isset($cacheConfig['clear'][$name])) { |
|
| 103 | - $this->cacheConfig = $cacheConfig['clear'][$name]; |
|
| 104 | - } |
|
| 105 | - } |
|
| 100 | + if ($cacheConfig && in_array($name, $cacheConfig['cache'])) { |
|
| 101 | + $this->cacheConfig = 'cache'; |
|
| 102 | + } elseif ($cacheConfig && isset($cacheConfig['clear'][$name])) { |
|
| 103 | + $this->cacheConfig = $cacheConfig['clear'][$name]; |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | 106 | } |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | if ($this->cacheConfig && $this->cacheConfig == 'cache') { |
| 75 | 75 | $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
| 76 | 76 | $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
| 77 | - return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function () use ($arguments, $name) { |
|
| 77 | + return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
|
| 78 | 78 | return call_user_func_array([$this->repo, $name], $arguments); |
| 79 | 79 | }); |
| 80 | 80 | } elseif ($this->cacheConfig && $this->cacheConfig == 'clear') { |
@@ -5,64 +5,64 @@ |
||
| 5 | 5 | |
| 6 | 6 | class LoginProxy |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Attempt to create an access token using user credentials. |
|
| 10 | - * |
|
| 11 | - * @param string $email |
|
| 12 | - * @param string $password |
|
| 13 | - * @return array |
|
| 14 | - */ |
|
| 15 | - public function login($email, $password) |
|
| 16 | - { |
|
| 17 | - return $this->proxy('password', [ |
|
| 18 | - 'username' => $email, |
|
| 19 | - 'password' => $password |
|
| 20 | - ]); |
|
| 21 | - } |
|
| 8 | + /** |
|
| 9 | + * Attempt to create an access token using user credentials. |
|
| 10 | + * |
|
| 11 | + * @param string $email |
|
| 12 | + * @param string $password |
|
| 13 | + * @return array |
|
| 14 | + */ |
|
| 15 | + public function login($email, $password) |
|
| 16 | + { |
|
| 17 | + return $this->proxy('password', [ |
|
| 18 | + 'username' => $email, |
|
| 19 | + 'password' => $password |
|
| 20 | + ]); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Attempt to refresh the access token using the given refresh token. |
|
| 25 | - * |
|
| 26 | - * @param string $refreshToken |
|
| 27 | - * @return array |
|
| 28 | - */ |
|
| 29 | - public function refreshToken($refreshToken) |
|
| 30 | - { |
|
| 31 | - return $this->proxy('refresh_token', [ |
|
| 32 | - 'refresh_token' => $refreshToken |
|
| 33 | - ]); |
|
| 34 | - } |
|
| 23 | + /** |
|
| 24 | + * Attempt to refresh the access token using the given refresh token. |
|
| 25 | + * |
|
| 26 | + * @param string $refreshToken |
|
| 27 | + * @return array |
|
| 28 | + */ |
|
| 29 | + public function refreshToken($refreshToken) |
|
| 30 | + { |
|
| 31 | + return $this->proxy('refresh_token', [ |
|
| 32 | + 'refresh_token' => $refreshToken |
|
| 33 | + ]); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Proxy a request to the OAuth server. |
|
| 38 | - * |
|
| 39 | - * @param string $grantType what type of grant type should be proxied |
|
| 40 | - * @param array |
|
| 41 | - */ |
|
| 42 | - public function proxy($grantType, array $data = []) |
|
| 43 | - { |
|
| 44 | - $data = array_merge($data, [ |
|
| 45 | - 'client_id' => config('skeleton.passport_client_id'), |
|
| 46 | - 'client_secret' => config('skeleton.passport_client_secret'), |
|
| 47 | - 'grant_type' => $grantType |
|
| 48 | - ]); |
|
| 36 | + /** |
|
| 37 | + * Proxy a request to the OAuth server. |
|
| 38 | + * |
|
| 39 | + * @param string $grantType what type of grant type should be proxied |
|
| 40 | + * @param array |
|
| 41 | + */ |
|
| 42 | + public function proxy($grantType, array $data = []) |
|
| 43 | + { |
|
| 44 | + $data = array_merge($data, [ |
|
| 45 | + 'client_id' => config('skeleton.passport_client_id'), |
|
| 46 | + 'client_secret' => config('skeleton.passport_client_secret'), |
|
| 47 | + 'grant_type' => $grantType |
|
| 48 | + ]); |
|
| 49 | 49 | |
| 50 | - $response = \ApiConsumer::post('/oauth/token', $data); |
|
| 50 | + $response = \ApiConsumer::post('/oauth/token', $data); |
|
| 51 | 51 | |
| 52 | - if (! $response->isSuccessful()) { |
|
| 53 | - if ($grantType == 'refresh_token') { |
|
| 54 | - \Errors::invalidRefreshToken(); |
|
| 55 | - } |
|
| 52 | + if (! $response->isSuccessful()) { |
|
| 53 | + if ($grantType == 'refresh_token') { |
|
| 54 | + \Errors::invalidRefreshToken(); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - \Errors::loginFailed(); |
|
| 58 | - } |
|
| 57 | + \Errors::loginFailed(); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - $data = json_decode($response->getContent()); |
|
| 60 | + $data = json_decode($response->getContent()); |
|
| 61 | 61 | |
| 62 | - return [ |
|
| 63 | - 'access_token' => $data->access_token, |
|
| 64 | - 'refresh_token' => $data->refresh_token, |
|
| 65 | - 'expires_in' => $data->expires_in |
|
| 66 | - ]; |
|
| 67 | - } |
|
| 62 | + return [ |
|
| 63 | + 'access_token' => $data->access_token, |
|
| 64 | + 'refresh_token' => $data->refresh_token, |
|
| 65 | + 'expires_in' => $data->expires_in |
|
| 66 | + ]; |
|
| 67 | + } |
|
| 68 | 68 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | |
| 50 | 50 | $response = \ApiConsumer::post('/oauth/token', $data); |
| 51 | 51 | |
| 52 | - if (! $response->isSuccessful()) { |
|
| 52 | + if ( ! $response->isSuccessful()) { |
|
| 53 | 53 | if ($grantType == 'refresh_token') { |
| 54 | 54 | \Errors::invalidRefreshToken(); |
| 55 | 55 | } |
@@ -6,61 +6,61 @@ |
||
| 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) { |
|
| 40 | - \Core::oauthClients()->revokeAccessToken($token); |
|
| 41 | - }); |
|
| 42 | - } |
|
| 43 | - } |
|
| 36 | + public function updated($model) |
|
| 37 | + { |
|
| 38 | + if ($model->isDirty('blocked') && $model->blocked) { |
|
| 39 | + $model->tokens()->each(function ($token) { |
|
| 40 | + \Core::oauthClients()->revokeAccessToken($token); |
|
| 41 | + }); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function deleting($model) |
|
| 46 | - { |
|
| 47 | - if ($model->getOriginal('id') == \Auth::id()) { |
|
| 48 | - \Errors::noPermissions(); |
|
| 49 | - } |
|
| 50 | - } |
|
| 45 | + public function deleting($model) |
|
| 46 | + { |
|
| 47 | + if ($model->getOriginal('id') == \Auth::id()) { |
|
| 48 | + \Errors::noPermissions(); |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - public function deleted($model) |
|
| 53 | - { |
|
| 54 | - // |
|
| 55 | - } |
|
| 52 | + public function deleted($model) |
|
| 53 | + { |
|
| 54 | + // |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - public function restoring($model) |
|
| 58 | - { |
|
| 59 | - // |
|
| 60 | - } |
|
| 57 | + public function restoring($model) |
|
| 58 | + { |
|
| 59 | + // |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - public function restored($model) |
|
| 63 | - { |
|
| 64 | - // |
|
| 65 | - } |
|
| 62 | + public function restored($model) |
|
| 63 | + { |
|
| 64 | + // |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | public function updated($model) |
| 37 | 37 | { |
| 38 | 38 | if ($model->isDirty('blocked') && $model->blocked) { |
| 39 | - $model->tokens()->each(function ($token) { |
|
| 39 | + $model->tokens()->each(function($token) { |
|
| 40 | 40 | \Core::oauthClients()->revokeAccessToken($token); |
| 41 | 41 | }); |
| 42 | 42 | } |
@@ -6,53 +6,53 @@ |
||
| 6 | 6 | class ReportObserver |
| 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 | } |