@@ -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 | } |
@@ -8,60 +8,60 @@ |
||
8 | 8 | |
9 | 9 | class PushNotificationDeviceRepository extends BaseRepository |
10 | 10 | { |
11 | - /** |
|
12 | - * Init new object. |
|
13 | - * |
|
14 | - * @param PushNotificationDevice $model |
|
15 | - * @return void |
|
16 | - */ |
|
17 | - public function __construct(PushNotificationDevice $model) |
|
18 | - { |
|
19 | - parent::__construct($model); |
|
20 | - } |
|
11 | + /** |
|
12 | + * Init new object. |
|
13 | + * |
|
14 | + * @param PushNotificationDevice $model |
|
15 | + * @return void |
|
16 | + */ |
|
17 | + public function __construct(PushNotificationDevice $model) |
|
18 | + { |
|
19 | + parent::__construct($model); |
|
20 | + } |
|
21 | 21 | |
22 | - /** |
|
23 | - * Register the given device to the logged in user. |
|
24 | - * |
|
25 | - * @param array $data |
|
26 | - * @return void |
|
27 | - */ |
|
28 | - public function registerDevice($data) |
|
29 | - { |
|
30 | - $data['access_token'] = \Auth::user()->token(); |
|
31 | - $data['user_id'] = \Auth::id(); |
|
32 | - $device = $this->model->where('device_token', $data['device_token'])-> |
|
33 | - where('user_id', $data['user_id'])-> |
|
34 | - first(); |
|
22 | + /** |
|
23 | + * Register the given device to the logged in user. |
|
24 | + * |
|
25 | + * @param array $data |
|
26 | + * @return void |
|
27 | + */ |
|
28 | + public function registerDevice($data) |
|
29 | + { |
|
30 | + $data['access_token'] = \Auth::user()->token(); |
|
31 | + $data['user_id'] = \Auth::id(); |
|
32 | + $device = $this->model->where('device_token', $data['device_token'])-> |
|
33 | + where('user_id', $data['user_id'])-> |
|
34 | + first(); |
|
35 | 35 | |
36 | - if ($device) { |
|
37 | - $data['id'] = $device->id; |
|
38 | - } |
|
36 | + if ($device) { |
|
37 | + $data['id'] = $device->id; |
|
38 | + } |
|
39 | 39 | |
40 | - return $this->save($data); |
|
41 | - } |
|
40 | + return $this->save($data); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * Generate the given message data. |
|
45 | - * |
|
46 | - * @param string $title |
|
47 | - * @param string $message |
|
48 | - * @param array $data |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function generateMessageData($title, $message, $data = []) |
|
52 | - { |
|
53 | - $optionBuilder = new OptionsBuilder(); |
|
54 | - $notificationBuilder = new PayloadNotificationBuilder($title); |
|
55 | - $dataBuilder = new PayloadDataBuilder(); |
|
43 | + /** |
|
44 | + * Generate the given message data. |
|
45 | + * |
|
46 | + * @param string $title |
|
47 | + * @param string $message |
|
48 | + * @param array $data |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function generateMessageData($title, $message, $data = []) |
|
52 | + { |
|
53 | + $optionBuilder = new OptionsBuilder(); |
|
54 | + $notificationBuilder = new PayloadNotificationBuilder($title); |
|
55 | + $dataBuilder = new PayloadDataBuilder(); |
|
56 | 56 | |
57 | - $optionBuilder->setTimeToLive(60 * 20); |
|
58 | - $notificationBuilder->setBody($message); |
|
59 | - $dataBuilder->addData($data); |
|
57 | + $optionBuilder->setTimeToLive(60 * 20); |
|
58 | + $notificationBuilder->setBody($message); |
|
59 | + $dataBuilder->addData($data); |
|
60 | 60 | |
61 | - $options = $optionBuilder->build(); |
|
62 | - $notification = $notificationBuilder->build(); |
|
63 | - $data = $dataBuilder->build(); |
|
61 | + $options = $optionBuilder->build(); |
|
62 | + $notification = $notificationBuilder->build(); |
|
63 | + $data = $dataBuilder->build(); |
|
64 | 64 | |
65 | - return compact('options', 'notification', 'data'); |
|
66 | - } |
|
65 | + return compact('options', 'notification', 'data'); |
|
66 | + } |
|
67 | 67 | } |
@@ -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 | } |
@@ -15,12 +15,12 @@ |
||
15 | 15 | |
16 | 16 | Route::group(['prefix' => 'push/notification/devices'], function () { |
17 | 17 | |
18 | - Route::get('/', 'PushNotificationDeviceController@index'); |
|
19 | - Route::get('/{id}', 'PushNotificationDeviceController@find'); |
|
20 | - Route::post('/', 'PushNotificationDeviceController@insert'); |
|
21 | - Route::put('/', 'PushNotificationDeviceController@update'); |
|
22 | - Route::delete('/{id}', 'PushNotificationDeviceController@delete'); |
|
23 | - Route::get('list/deleted', 'PushNotificationDeviceController@deleted'); |
|
24 | - Route::patch('restore/{id}', 'PushNotificationDeviceController@restore'); |
|
25 | - Route::post('register/device', 'PushNotificationDeviceController@registerDevice'); |
|
18 | + Route::get('/', 'PushNotificationDeviceController@index'); |
|
19 | + Route::get('/{id}', 'PushNotificationDeviceController@find'); |
|
20 | + Route::post('/', 'PushNotificationDeviceController@insert'); |
|
21 | + Route::put('/', 'PushNotificationDeviceController@update'); |
|
22 | + Route::delete('/{id}', 'PushNotificationDeviceController@delete'); |
|
23 | + Route::get('list/deleted', 'PushNotificationDeviceController@deleted'); |
|
24 | + Route::patch('restore/{id}', 'PushNotificationDeviceController@restore'); |
|
25 | + Route::post('register/device', 'PushNotificationDeviceController@registerDevice'); |
|
26 | 26 | }); |
27 | 27 | \ No newline at end of file |
@@ -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 | } |
@@ -7,73 +7,73 @@ |
||
7 | 7 | |
8 | 8 | class RouteServiceProvider extends ServiceProvider |
9 | 9 | { |
10 | - /** |
|
11 | - * This namespace is applied to your controller routes. |
|
12 | - * |
|
13 | - * In addition, it is set as the URL generator's root namespace. |
|
14 | - * |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - protected $namespace = 'App\Modules\PushNotificationDevices\Http\Controllers'; |
|
10 | + /** |
|
11 | + * This namespace is applied to your controller routes. |
|
12 | + * |
|
13 | + * In addition, it is set as the URL generator's root namespace. |
|
14 | + * |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + protected $namespace = 'App\Modules\PushNotificationDevices\Http\Controllers'; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Define your route model bindings, pattern filters, etc. |
|
21 | - * |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function boot() |
|
25 | - { |
|
26 | - // |
|
19 | + /** |
|
20 | + * Define your route model bindings, pattern filters, etc. |
|
21 | + * |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function boot() |
|
25 | + { |
|
26 | + // |
|
27 | 27 | |
28 | - parent::boot(); |
|
29 | - } |
|
28 | + parent::boot(); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Define the routes for the module. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function map() |
|
37 | - { |
|
38 | - $this->mapWebRoutes(); |
|
31 | + /** |
|
32 | + * Define the routes for the module. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function map() |
|
37 | + { |
|
38 | + $this->mapWebRoutes(); |
|
39 | 39 | |
40 | - $this->mapApiRoutes(); |
|
40 | + $this->mapApiRoutes(); |
|
41 | 41 | |
42 | - // |
|
43 | - } |
|
42 | + // |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Define the "web" routes for the module. |
|
47 | - * |
|
48 | - * These routes all receive session state, CSRF protection, etc. |
|
49 | - * |
|
50 | - * @return void |
|
51 | - */ |
|
52 | - protected function mapWebRoutes() |
|
53 | - { |
|
54 | - Route::group([ |
|
55 | - 'middleware' => 'web', |
|
56 | - 'namespace' => $this->namespace, |
|
57 | - ], function ($router) { |
|
58 | - require module_path('push-notification-devices', 'Routes/web.php', 'app'); |
|
59 | - }); |
|
60 | - } |
|
45 | + /** |
|
46 | + * Define the "web" routes for the module. |
|
47 | + * |
|
48 | + * These routes all receive session state, CSRF protection, etc. |
|
49 | + * |
|
50 | + * @return void |
|
51 | + */ |
|
52 | + protected function mapWebRoutes() |
|
53 | + { |
|
54 | + Route::group([ |
|
55 | + 'middleware' => 'web', |
|
56 | + 'namespace' => $this->namespace, |
|
57 | + ], function ($router) { |
|
58 | + require module_path('push-notification-devices', 'Routes/web.php', 'app'); |
|
59 | + }); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Define the "api" routes for the module. |
|
64 | - * |
|
65 | - * These routes are typically stateless. |
|
66 | - * |
|
67 | - * @return void |
|
68 | - */ |
|
69 | - protected function mapApiRoutes() |
|
70 | - { |
|
71 | - Route::group([ |
|
72 | - 'middleware' => 'api', |
|
73 | - 'namespace' => $this->namespace, |
|
74 | - 'prefix' => 'api', |
|
75 | - ], function ($router) { |
|
76 | - require module_path('push-notification-devices', 'Routes/api.php', 'app'); |
|
77 | - }); |
|
78 | - } |
|
62 | + /** |
|
63 | + * Define the "api" routes for the module. |
|
64 | + * |
|
65 | + * These routes are typically stateless. |
|
66 | + * |
|
67 | + * @return void |
|
68 | + */ |
|
69 | + protected function mapApiRoutes() |
|
70 | + { |
|
71 | + Route::group([ |
|
72 | + 'middleware' => 'api', |
|
73 | + 'namespace' => $this->namespace, |
|
74 | + 'prefix' => 'api', |
|
75 | + ], function ($router) { |
|
76 | + require module_path('push-notification-devices', 'Routes/api.php', 'app'); |
|
77 | + }); |
|
78 | + } |
|
79 | 79 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $factory->define(App\Modules\PushNotificationDevices\PushNotificationDevice::class, function (Faker\Generator $faker) { |
4 | - return [ |
|
5 | - 'device_token' => $faker->sha1(), |
|
6 | - 'user_id' => $faker->randomDigitNotNull(), |
|
7 | - 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
8 | - 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
9 | - ]; |
|
4 | + return [ |
|
5 | + 'device_token' => $faker->sha1(), |
|
6 | + 'user_id' => $faker->randomDigitNotNull(), |
|
7 | + 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
8 | + 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
9 | + ]; |
|
10 | 10 | }); |
@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class AssignRelationsSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Assign the permissions to the admin group. |
|
20 | - */ |
|
21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['pushNotificationDevice'])->each(function ($permission) use ($adminGroupId) { |
|
22 | - \DB::table('groups_permissions')->insert( |
|
23 | - [ |
|
24 | - 'permission_id' => $permission->id, |
|
25 | - 'group_id' => $adminGroupId, |
|
26 | - 'created_at' => \DB::raw('NOW()'), |
|
27 | - 'updated_at' => \DB::raw('NOW()') |
|
28 | - ] |
|
29 | - ); |
|
30 | - }); |
|
31 | - } |
|
18 | + /** |
|
19 | + * Assign the permissions to the admin group. |
|
20 | + */ |
|
21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['pushNotificationDevice'])->each(function ($permission) use ($adminGroupId) { |
|
22 | + \DB::table('groups_permissions')->insert( |
|
23 | + [ |
|
24 | + 'permission_id' => $permission->id, |
|
25 | + 'group_id' => $adminGroupId, |
|
26 | + 'created_at' => \DB::raw('NOW()'), |
|
27 | + 'updated_at' => \DB::raw('NOW()') |
|
28 | + ] |
|
29 | + ); |
|
30 | + }); |
|
31 | + } |
|
32 | 32 | } |