@@ -6,28 +6,28 @@ |
||
6 | 6 | |
7 | 7 | class ResetPassword extends FormRequest |
8 | 8 | { |
9 | - /** |
|
10 | - * Determine if the user is authorized to make this request. |
|
11 | - * |
|
12 | - * @return bool |
|
13 | - */ |
|
14 | - public function authorize() |
|
15 | - { |
|
16 | - return true; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Determine if the user is authorized to make this request. |
|
11 | + * |
|
12 | + * @return bool |
|
13 | + */ |
|
14 | + public function authorize() |
|
15 | + { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * Get the validation rules that apply to the request. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function rules() |
|
25 | - { |
|
26 | - return [ |
|
27 | - 'token' => 'required', |
|
28 | - 'email' => 'required|email', |
|
29 | - 'password' => 'required|confirmed|min:6', |
|
30 | - 'password_confirmation' => 'required', |
|
31 | - ]; |
|
32 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'token' => 'required', |
|
28 | + 'email' => 'required|email', |
|
29 | + 'password' => 'required|confirmed|min:6', |
|
30 | + 'password_confirmation' => 'required', |
|
31 | + ]; |
|
32 | + } |
|
33 | 33 | } |
@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class Register extends FormRequest |
8 | 8 | { |
9 | - /** |
|
10 | - * Determine if the user is authorized to make this request. |
|
11 | - * |
|
12 | - * @return bool |
|
13 | - */ |
|
14 | - public function authorize() |
|
15 | - { |
|
16 | - return true; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Determine if the user is authorized to make this request. |
|
11 | + * |
|
12 | + * @return bool |
|
13 | + */ |
|
14 | + public function authorize() |
|
15 | + { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * Get the validation rules that apply to the request. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function rules() |
|
25 | - { |
|
26 | - return [ |
|
27 | - 'name' => 'nullable|string', |
|
28 | - 'email' => 'required|email|unique:users,email,'.$this->get('id'), |
|
29 | - 'password' => 'required|min:6' |
|
30 | - ]; |
|
31 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'name' => 'nullable|string', |
|
28 | + 'email' => 'required|email|unique:users,email,'.$this->get('id'), |
|
29 | + 'password' => 'required|min:6' |
|
30 | + ]; |
|
31 | + } |
|
32 | 32 | } |
@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class Login extends FormRequest |
8 | 8 | { |
9 | - /** |
|
10 | - * Determine if the user is authorized to make this request. |
|
11 | - * |
|
12 | - * @return bool |
|
13 | - */ |
|
14 | - public function authorize() |
|
15 | - { |
|
16 | - return true; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Determine if the user is authorized to make this request. |
|
11 | + * |
|
12 | + * @return bool |
|
13 | + */ |
|
14 | + public function authorize() |
|
15 | + { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * Get the validation rules that apply to the request. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function rules() |
|
25 | - { |
|
26 | - return [ |
|
27 | - 'email' => 'required|email', |
|
28 | - 'password' => 'required|min:6', |
|
29 | - 'admin' => 'nullable|boolean' |
|
30 | - ]; |
|
31 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'email' => 'required|email', |
|
28 | + 'password' => 'required|min:6', |
|
29 | + 'admin' => 'nullable|boolean' |
|
30 | + ]; |
|
31 | + } |
|
32 | 32 | } |
@@ -6,26 +6,26 @@ |
||
6 | 6 | |
7 | 7 | class AssignGroups extends FormRequest |
8 | 8 | { |
9 | - /** |
|
10 | - * Determine if the user is authorized to make this request. |
|
11 | - * |
|
12 | - * @return bool |
|
13 | - */ |
|
14 | - public function authorize() |
|
15 | - { |
|
16 | - return true; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Determine if the user is authorized to make this request. |
|
11 | + * |
|
12 | + * @return bool |
|
13 | + */ |
|
14 | + public function authorize() |
|
15 | + { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * Get the validation rules that apply to the request. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function rules() |
|
25 | - { |
|
26 | - return [ |
|
27 | - 'group_ids' => 'required|exists:groups,id', |
|
28 | - 'user_id' => 'required|exists:users,id' |
|
29 | - ]; |
|
30 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'group_ids' => 'required|exists:groups,id', |
|
28 | + 'user_id' => 'required|exists:users,id' |
|
29 | + ]; |
|
30 | + } |
|
31 | 31 | } |
@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class LoginSocial extends FormRequest |
8 | 8 | { |
9 | - /** |
|
10 | - * Determine if the user is authorized to make this request. |
|
11 | - * |
|
12 | - * @return bool |
|
13 | - */ |
|
14 | - public function authorize() |
|
15 | - { |
|
16 | - return true; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Determine if the user is authorized to make this request. |
|
11 | + * |
|
12 | + * @return bool |
|
13 | + */ |
|
14 | + public function authorize() |
|
15 | + { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * Get the validation rules that apply to the request. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function rules() |
|
25 | - { |
|
26 | - return [ |
|
27 | - 'auth_code' => 'required_without:access_token', |
|
28 | - 'access_token' => 'required_without:auth_code', |
|
29 | - 'type' => 'required|in:facebook,google' |
|
30 | - ]; |
|
31 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'auth_code' => 'required_without:access_token', |
|
28 | + 'access_token' => 'required_without:auth_code', |
|
29 | + 'type' => 'required|in:facebook,google' |
|
30 | + ]; |
|
31 | + } |
|
32 | 32 | } |
@@ -6,25 +6,25 @@ |
||
6 | 6 | |
7 | 7 | class ConfirmEmail extends FormRequest |
8 | 8 | { |
9 | - /** |
|
10 | - * Determine if the user is authorized to make this request. |
|
11 | - * |
|
12 | - * @return bool |
|
13 | - */ |
|
14 | - public function authorize() |
|
15 | - { |
|
16 | - return true; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Determine if the user is authorized to make this request. |
|
11 | + * |
|
12 | + * @return bool |
|
13 | + */ |
|
14 | + public function authorize() |
|
15 | + { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * Get the validation rules that apply to the request. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function rules() |
|
25 | - { |
|
26 | - return [ |
|
27 | - 'confirmation_code' => 'required|string' |
|
28 | - ]; |
|
29 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'confirmation_code' => 'required|string' |
|
28 | + ]; |
|
29 | + } |
|
30 | 30 | } |
@@ -2,77 +2,77 @@ |
||
2 | 2 | |
3 | 3 | class LoginProxy |
4 | 4 | { |
5 | - /** |
|
6 | - * Attempt to create an access token using user credentials. |
|
7 | - * |
|
8 | - * @param array $credentials |
|
9 | - * @param boolean $adminLogin |
|
10 | - * @return array |
|
11 | - */ |
|
12 | - public function login($credentials, $adminLogin = false) |
|
13 | - { |
|
14 | - $user = \Core::users()->login($credentials, $adminLogin); |
|
15 | - $tokens = $this->proxy('password', [ |
|
16 | - 'username' => $credentials['email'], |
|
17 | - 'password' => $credentials['password'] |
|
18 | - ]); |
|
5 | + /** |
|
6 | + * Attempt to create an access token using user credentials. |
|
7 | + * |
|
8 | + * @param array $credentials |
|
9 | + * @param boolean $adminLogin |
|
10 | + * @return array |
|
11 | + */ |
|
12 | + public function login($credentials, $adminLogin = false) |
|
13 | + { |
|
14 | + $user = \Core::users()->login($credentials, $adminLogin); |
|
15 | + $tokens = $this->proxy('password', [ |
|
16 | + 'username' => $credentials['email'], |
|
17 | + 'password' => $credentials['password'] |
|
18 | + ]); |
|
19 | 19 | |
20 | - return compact('user', 'tokens'); |
|
21 | - } |
|
20 | + return compact('user', 'tokens'); |
|
21 | + } |
|
22 | 22 | |
23 | - /** |
|
24 | - * Attempt to refresh the access token useing 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 useing 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 | - \ErrorHandler::invalidRefreshToken(); |
|
55 | - } |
|
52 | + if (! $response->isSuccessful()) { |
|
53 | + if ($grantType == 'refresh_token') { |
|
54 | + \ErrorHandler::invalidRefreshToken(); |
|
55 | + } |
|
56 | 56 | |
57 | - \ErrorHandler::loginFailed(); |
|
58 | - } |
|
57 | + \ErrorHandler::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 | |
69 | - /** |
|
70 | - * Logs out the user. We revoke access token and refresh token. |
|
71 | - * |
|
72 | - * @return void |
|
73 | - */ |
|
74 | - public function logout() |
|
75 | - { |
|
76 | - \Core::users()->revokeAccessToken(\Auth::user()->token()); |
|
77 | - } |
|
69 | + /** |
|
70 | + * Logs out the user. We revoke access token and refresh token. |
|
71 | + * |
|
72 | + * @return void |
|
73 | + */ |
|
74 | + public function logout() |
|
75 | + { |
|
76 | + \Core::users()->revokeAccessToken(\Auth::user()->token()); |
|
77 | + } |
|
78 | 78 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | $response = \ApiConsumer::post('/oauth/token', $data); |
53 | 53 | |
54 | - if (! $response->isSuccessful()) { |
|
54 | + if ( ! $response->isSuccessful()) { |
|
55 | 55 | if ($grantType == 'refresh_token') { |
56 | 56 | \ErrorHandler::invalidRefreshToken(); |
57 | 57 | } |
@@ -6,53 +6,53 @@ |
||
6 | 6 | class PushNotificationDeviceObserver |
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,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'push-notification-devices'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'push-notification-devices'); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'push-notification-devices'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'push-notification-devices'); |
|
18 | 18 | |
19 | - $this->loadMigrationsFrom(module_path('push-notification-devices', 'Database/Migrations', 'app')); |
|
20 | - $this->loadFactoriesFrom(module_path('push-notification-devices', 'Database/Factories', 'app')); |
|
21 | - } |
|
19 | + $this->loadMigrationsFrom(module_path('push-notification-devices', 'Database/Migrations', 'app')); |
|
20 | + $this->loadFactoriesFrom(module_path('push-notification-devices', 'Database/Factories', 'app')); |
|
21 | + } |
|
22 | 22 | |
23 | - /** |
|
24 | - * Register the module services. |
|
25 | - * |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - public function register() |
|
29 | - { |
|
30 | - $this->app->register(RouteServiceProvider::class); |
|
31 | - } |
|
23 | + /** |
|
24 | + * Register the module services. |
|
25 | + * |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + public function register() |
|
29 | + { |
|
30 | + $this->app->register(RouteServiceProvider::class); |
|
31 | + } |
|
32 | 32 | } |