@@ -11,7 +11,7 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Route::group(['prefix' => 'oauth/clients'], function () { |
|
14 | +Route::group(['prefix' => 'oauth/clients'], function() { |
|
15 | 15 | |
16 | 16 | Route::get('/', 'OauthClientController@index'); |
17 | 17 | Route::get('/{id}', 'OauthClientController@find'); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | | |
14 | 14 | */ |
15 | 15 | |
16 | -Route::group(['prefix' => 'push/notification/devices'], function () { |
|
16 | +Route::group(['prefix' => 'push/notification/devices'], function() { |
|
17 | 17 | |
18 | 18 | Route::get('/', 'PushNotificationDeviceController@index'); |
19 | 19 | Route::get('/{id}', 'PushNotificationDeviceController@find'); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | | |
14 | 14 | */ |
15 | 15 | |
16 | -Route::group(['prefix' => 'groups'], function () { |
|
16 | +Route::group(['prefix' => 'groups'], function() { |
|
17 | 17 | |
18 | 18 | Route::get('/', 'GroupController@index'); |
19 | 19 | Route::get('/{id}', 'GroupController@find'); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Route::group(['prefix' => 'reports'], function () { |
|
14 | +Route::group(['prefix' => 'reports'], function() { |
|
15 | 15 | |
16 | 16 | Route::get('/', 'ReportController@index'); |
17 | 17 | Route::get('/{id}', 'ReportController@find'); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | | |
14 | 14 | */ |
15 | 15 | |
16 | -Route::group(['prefix' => 'permissions'], function () { |
|
16 | +Route::group(['prefix' => 'permissions'], function() { |
|
17 | 17 | |
18 | 18 | Route::get('/', 'PermissionController@index'); |
19 | 19 | Route::get('/{id}', 'PermissionController@find'); |
@@ -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 boolean |
|
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 boolean |
|
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 | } |
@@ -9,34 +9,34 @@ |
||
9 | 9 | |
10 | 10 | class ReportController extends BaseApiController |
11 | 11 | { |
12 | - /** |
|
13 | - * List of all route actions that the base api controller |
|
14 | - * will skip permissions check for them. |
|
15 | - * @var array |
|
16 | - */ |
|
17 | - protected $skipPermissionCheck = ['getReport']; |
|
12 | + /** |
|
13 | + * List of all route actions that the base api controller |
|
14 | + * will skip permissions check for them. |
|
15 | + * @var array |
|
16 | + */ |
|
17 | + protected $skipPermissionCheck = ['getReport']; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Init new object. |
|
21 | - * |
|
22 | - * @param ReportRepository $repo |
|
23 | - * @param CoreConfig $config |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function __construct(ReportRepository $repo, CoreConfig $config) |
|
27 | - { |
|
28 | - parent::__construct($repo, $config, 'App\Modules\Reporting\Http\Resources\Report'); |
|
29 | - } |
|
19 | + /** |
|
20 | + * Init new object. |
|
21 | + * |
|
22 | + * @param ReportRepository $repo |
|
23 | + * @param CoreConfig $config |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function __construct(ReportRepository $repo, CoreConfig $config) |
|
27 | + { |
|
28 | + parent::__construct($repo, $config, 'App\Modules\Reporting\Http\Resources\Report'); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Render the given report name with the given conditions. |
|
33 | - * |
|
34 | - * @param Request $request |
|
35 | - * @param string $reportName Name of the requested report |
|
36 | - * @return \Illuminate\Http\JsonResponse |
|
37 | - */ |
|
38 | - public function getReport(Request $request, $reportName) |
|
39 | - { |
|
40 | - return \Response::json($this->repo->getReport($reportName, $request->all(), $request->query('perPage')), 200); |
|
41 | - } |
|
31 | + /** |
|
32 | + * Render the given report name with the given conditions. |
|
33 | + * |
|
34 | + * @param Request $request |
|
35 | + * @param string $reportName Name of the requested report |
|
36 | + * @return \Illuminate\Http\JsonResponse |
|
37 | + */ |
|
38 | + public function getReport(Request $request, $reportName) |
|
39 | + { |
|
40 | + return \Response::json($this->repo->getReport($reportName, $request->all(), $request->query('perPage')), 200); |
|
41 | + } |
|
42 | 42 | } |