@@ -13,27 +13,27 @@ |
||
13 | 13 | |
14 | 14 | Route::group(['prefix' => 'notifications'], function () { |
15 | 15 | |
16 | - Route::group(['prefix' => 'notifications'], function () { |
|
16 | + Route::group(['prefix' => 'notifications'], function () { |
|
17 | 17 | |
18 | - Route::get('list/{perPage?}', 'NotificationsController@list'); |
|
19 | - Route::get('unread/{perPage?}', 'NotificationsController@unread'); |
|
20 | - Route::get('markAsRead/{id}', 'NotificationsController@markAsRead'); |
|
21 | - Route::get('markAllAsRead', 'NotificationsController@markAllAsRead'); |
|
22 | - }); |
|
18 | + Route::get('list/{perPage?}', 'NotificationsController@list'); |
|
19 | + Route::get('unread/{perPage?}', 'NotificationsController@unread'); |
|
20 | + Route::get('markAsRead/{id}', 'NotificationsController@markAsRead'); |
|
21 | + Route::get('markAllAsRead', 'NotificationsController@markAllAsRead'); |
|
22 | + }); |
|
23 | 23 | |
24 | - Route::group(['prefix' => 'push_notification_devices'], function () { |
|
24 | + Route::group(['prefix' => 'push_notification_devices'], function () { |
|
25 | 25 | |
26 | - Route::get('list/{sortBy?}/{desc?}', 'PushNotificationDevicesController@index'); |
|
27 | - Route::get('find/{id}', 'PushNotificationDevicesController@find'); |
|
28 | - Route::get('search/{query?}/{perPage?}/{sortBy?}/{desc?}', 'PushNotificationDevicesController@search'); |
|
29 | - Route::get('paginate/{perPage?}/{sortBy?}/{desc?}', 'PushNotificationDevicesController@paginate'); |
|
30 | - Route::get('delete/{id}', 'PushNotificationDevicesController@delete'); |
|
31 | - Route::get('restore/{id}', 'PushNotificationDevicesController@restore'); |
|
32 | - Route::post('first', 'PushNotificationDevicesController@first'); |
|
33 | - Route::post('findby/{sortBy?}/{desc?}', 'PushNotificationDevicesController@findby'); |
|
34 | - Route::post('paginateby/{perPage?}/{sortBy?}/{desc?}', 'PushNotificationDevicesController@paginateby'); |
|
35 | - Route::post('save', 'PushNotificationDevicesController@save'); |
|
36 | - Route::post('deleted/{perPage?}/{sortBy?}/{desc?}', 'PushNotificationDevicesController@deleted'); |
|
37 | - Route::post('register/device', 'PushNotificationDevicesController@registerDevice'); |
|
38 | - }); |
|
26 | + Route::get('list/{sortBy?}/{desc?}', 'PushNotificationDevicesController@index'); |
|
27 | + Route::get('find/{id}', 'PushNotificationDevicesController@find'); |
|
28 | + Route::get('search/{query?}/{perPage?}/{sortBy?}/{desc?}', 'PushNotificationDevicesController@search'); |
|
29 | + Route::get('paginate/{perPage?}/{sortBy?}/{desc?}', 'PushNotificationDevicesController@paginate'); |
|
30 | + Route::get('delete/{id}', 'PushNotificationDevicesController@delete'); |
|
31 | + Route::get('restore/{id}', 'PushNotificationDevicesController@restore'); |
|
32 | + Route::post('first', 'PushNotificationDevicesController@first'); |
|
33 | + Route::post('findby/{sortBy?}/{desc?}', 'PushNotificationDevicesController@findby'); |
|
34 | + Route::post('paginateby/{perPage?}/{sortBy?}/{desc?}', 'PushNotificationDevicesController@paginateby'); |
|
35 | + Route::post('save', 'PushNotificationDevicesController@save'); |
|
36 | + Route::post('deleted/{perPage?}/{sortBy?}/{desc?}', 'PushNotificationDevicesController@deleted'); |
|
37 | + Route::post('register/device', 'PushNotificationDevicesController@registerDevice'); |
|
38 | + }); |
|
39 | 39 | }); |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Route::group(['prefix' => 'notifications'], function () { |
|
14 | +Route::group(['prefix' => 'notifications'], function() { |
|
15 | 15 | |
16 | - Route::group(['prefix' => 'notifications'], function () { |
|
16 | + Route::group(['prefix' => 'notifications'], function() { |
|
17 | 17 | |
18 | 18 | Route::get('list/{perPage?}', 'NotificationsController@list'); |
19 | 19 | Route::get('unread/{perPage?}', 'NotificationsController@unread'); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | Route::get('markAllAsRead', 'NotificationsController@markAllAsRead'); |
22 | 22 | }); |
23 | 23 | |
24 | - Route::group(['prefix' => 'push_notification_devices'], function () { |
|
24 | + Route::group(['prefix' => 'push_notification_devices'], function() { |
|
25 | 25 | |
26 | 26 | Route::get('list/{sortBy?}/{desc?}', 'PushNotificationDevicesController@index'); |
27 | 27 | Route::get('find/{id}', 'PushNotificationDevicesController@find'); |
@@ -6,88 +6,88 @@ |
||
6 | 6 | |
7 | 7 | class PushNotificationsDevicesTableSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - /** |
|
17 | - * Insert the permissions related to settings table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * pushNotificationDevices model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'find', |
|
26 | - 'model' => 'pushNotificationDevices', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'search', |
|
32 | - 'model' => 'pushNotificationDevices', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - [ |
|
37 | - 'name' => 'list', |
|
38 | - 'model' => 'pushNotificationDevices', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'findby', |
|
44 | - 'model' => 'pushNotificationDevices', |
|
45 | - 'created_at' => \DB::raw('NOW()'), |
|
46 | - 'updated_at' => \DB::raw('NOW()') |
|
47 | - ], |
|
48 | - [ |
|
49 | - 'name' => 'first', |
|
50 | - 'model' => 'pushNotificationDevices', |
|
51 | - 'created_at' => \DB::raw('NOW()'), |
|
52 | - 'updated_at' => \DB::raw('NOW()') |
|
53 | - ], |
|
54 | - [ |
|
55 | - 'name' => 'paginate', |
|
56 | - 'model' => 'pushNotificationDevices', |
|
57 | - 'created_at' => \DB::raw('NOW()'), |
|
58 | - 'updated_at' => \DB::raw('NOW()') |
|
59 | - ], |
|
60 | - [ |
|
61 | - 'name' => 'paginateby', |
|
62 | - 'model' => 'pushNotificationDevices', |
|
63 | - 'created_at' => \DB::raw('NOW()'), |
|
64 | - 'updated_at' => \DB::raw('NOW()') |
|
65 | - ], |
|
66 | - [ |
|
67 | - 'name' => 'save', |
|
68 | - 'model' => 'pushNotificationDevices', |
|
69 | - 'created_at' => \DB::raw('NOW()'), |
|
70 | - 'updated_at' => \DB::raw('NOW()') |
|
71 | - ], |
|
72 | - [ |
|
73 | - 'name' => 'delete', |
|
74 | - 'model' => 'pushNotificationDevices', |
|
75 | - 'created_at' => \DB::raw('NOW()'), |
|
76 | - 'updated_at' => \DB::raw('NOW()') |
|
77 | - ], |
|
78 | - [ |
|
79 | - 'name' => 'deleted', |
|
80 | - 'model' => 'pushNotificationDevices', |
|
81 | - 'created_at' => \DB::raw('NOW()'), |
|
82 | - 'updated_at' => \DB::raw('NOW()') |
|
83 | - ], |
|
84 | - [ |
|
85 | - 'name' => 'restore', |
|
86 | - 'model' => 'pushNotificationDevices', |
|
87 | - 'created_at' => \DB::raw('NOW()'), |
|
88 | - 'updated_at' => \DB::raw('NOW()') |
|
89 | - ] |
|
90 | - ] |
|
91 | - ); |
|
92 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to settings table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * pushNotificationDevices model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'find', |
|
26 | + 'model' => 'pushNotificationDevices', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'search', |
|
32 | + 'model' => 'pushNotificationDevices', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + [ |
|
37 | + 'name' => 'list', |
|
38 | + 'model' => 'pushNotificationDevices', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'findby', |
|
44 | + 'model' => 'pushNotificationDevices', |
|
45 | + 'created_at' => \DB::raw('NOW()'), |
|
46 | + 'updated_at' => \DB::raw('NOW()') |
|
47 | + ], |
|
48 | + [ |
|
49 | + 'name' => 'first', |
|
50 | + 'model' => 'pushNotificationDevices', |
|
51 | + 'created_at' => \DB::raw('NOW()'), |
|
52 | + 'updated_at' => \DB::raw('NOW()') |
|
53 | + ], |
|
54 | + [ |
|
55 | + 'name' => 'paginate', |
|
56 | + 'model' => 'pushNotificationDevices', |
|
57 | + 'created_at' => \DB::raw('NOW()'), |
|
58 | + 'updated_at' => \DB::raw('NOW()') |
|
59 | + ], |
|
60 | + [ |
|
61 | + 'name' => 'paginateby', |
|
62 | + 'model' => 'pushNotificationDevices', |
|
63 | + 'created_at' => \DB::raw('NOW()'), |
|
64 | + 'updated_at' => \DB::raw('NOW()') |
|
65 | + ], |
|
66 | + [ |
|
67 | + 'name' => 'save', |
|
68 | + 'model' => 'pushNotificationDevices', |
|
69 | + 'created_at' => \DB::raw('NOW()'), |
|
70 | + 'updated_at' => \DB::raw('NOW()') |
|
71 | + ], |
|
72 | + [ |
|
73 | + 'name' => 'delete', |
|
74 | + 'model' => 'pushNotificationDevices', |
|
75 | + 'created_at' => \DB::raw('NOW()'), |
|
76 | + 'updated_at' => \DB::raw('NOW()') |
|
77 | + ], |
|
78 | + [ |
|
79 | + 'name' => 'deleted', |
|
80 | + 'model' => 'pushNotificationDevices', |
|
81 | + 'created_at' => \DB::raw('NOW()'), |
|
82 | + 'updated_at' => \DB::raw('NOW()') |
|
83 | + ], |
|
84 | + [ |
|
85 | + 'name' => 'restore', |
|
86 | + 'model' => 'pushNotificationDevices', |
|
87 | + 'created_at' => \DB::raw('NOW()'), |
|
88 | + 'updated_at' => \DB::raw('NOW()') |
|
89 | + ] |
|
90 | + ] |
|
91 | + ); |
|
92 | + } |
|
93 | 93 | } |
@@ -5,31 +5,31 @@ |
||
5 | 5 | |
6 | 6 | class PushNotificationsDevices extends Migration |
7 | 7 | { |
8 | - /** |
|
9 | - * Run the migrations. |
|
10 | - * |
|
11 | - * @return void |
|
12 | - */ |
|
13 | - public function up() |
|
14 | - { |
|
15 | - Schema::create('push_notification_devices', function (Blueprint $table) { |
|
16 | - $table->increments('id'); |
|
17 | - $table->string('device_token'); |
|
18 | - $table->integer('user_id'); |
|
19 | - $table->text('access_token')->nullable(); |
|
20 | - $table->unique(array('device_token', 'user_id')); |
|
21 | - $table->softDeletes(); |
|
22 | - $table->timestamps(); |
|
23 | - }); |
|
24 | - } |
|
8 | + /** |
|
9 | + * Run the migrations. |
|
10 | + * |
|
11 | + * @return void |
|
12 | + */ |
|
13 | + public function up() |
|
14 | + { |
|
15 | + Schema::create('push_notification_devices', function (Blueprint $table) { |
|
16 | + $table->increments('id'); |
|
17 | + $table->string('device_token'); |
|
18 | + $table->integer('user_id'); |
|
19 | + $table->text('access_token')->nullable(); |
|
20 | + $table->unique(array('device_token', 'user_id')); |
|
21 | + $table->softDeletes(); |
|
22 | + $table->timestamps(); |
|
23 | + }); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Reverse the migrations. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function down() |
|
32 | - { |
|
33 | - Schema::dropIfExists('push_notifications_devices'); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Reverse the migrations. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function down() |
|
32 | + { |
|
33 | + Schema::dropIfExists('push_notifications_devices'); |
|
34 | + } |
|
35 | 35 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('push_notification_devices', function (Blueprint $table) { |
|
15 | + Schema::create('push_notification_devices', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->string('device_token'); |
18 | 18 | $table->integer('user_id'); |
@@ -6,21 +6,21 @@ |
||
6 | 6 | |
7 | 7 | class Notification extends JsonResource |
8 | 8 | { |
9 | - /** |
|
10 | - * Transform the resource into an array. |
|
11 | - * |
|
12 | - * @param \Illuminate\Http\Request $request |
|
13 | - * @return array |
|
14 | - */ |
|
15 | - public function toArray($request) |
|
16 | - { |
|
17 | - return [ |
|
18 | - 'id' => $this->id, |
|
19 | - 'type' => $this->type, |
|
20 | - 'data' => $this->data, |
|
21 | - 'readAt' => $this->read_at, |
|
22 | - 'createdAt' => $this->created_at, |
|
23 | - 'updatedAt' => $this->updated_at, |
|
24 | - ]; |
|
25 | - } |
|
9 | + /** |
|
10 | + * Transform the resource into an array. |
|
11 | + * |
|
12 | + * @param \Illuminate\Http\Request $request |
|
13 | + * @return array |
|
14 | + */ |
|
15 | + public function toArray($request) |
|
16 | + { |
|
17 | + return [ |
|
18 | + 'id' => $this->id, |
|
19 | + 'type' => $this->type, |
|
20 | + 'data' => $this->data, |
|
21 | + 'readAt' => $this->read_at, |
|
22 | + 'createdAt' => $this->created_at, |
|
23 | + 'updatedAt' => $this->updated_at, |
|
24 | + ]; |
|
25 | + } |
|
26 | 26 | } |
@@ -7,22 +7,22 @@ |
||
7 | 7 | |
8 | 8 | class PushNotificationDevice extends JsonResource |
9 | 9 | { |
10 | - /** |
|
11 | - * Transform the resource into an array. |
|
12 | - * |
|
13 | - * @param \Illuminate\Http\Request $request |
|
14 | - * @return array |
|
15 | - */ |
|
16 | - public function toArray($request) |
|
17 | - { |
|
18 | - return [ |
|
19 | - 'id' => $this->id, |
|
20 | - 'deviceToken' => $this->device_token, |
|
21 | - 'accessToken' => $this->access_token, |
|
22 | - 'user' => new UserResource($this->whenLoaded('user')), |
|
23 | - 'timeZone' => $this->time_zone, |
|
24 | - 'createdAt' => $this->created_at, |
|
25 | - 'updatedAt' => $this->updated_at, |
|
26 | - ]; |
|
27 | - } |
|
10 | + /** |
|
11 | + * Transform the resource into an array. |
|
12 | + * |
|
13 | + * @param \Illuminate\Http\Request $request |
|
14 | + * @return array |
|
15 | + */ |
|
16 | + public function toArray($request) |
|
17 | + { |
|
18 | + return [ |
|
19 | + 'id' => $this->id, |
|
20 | + 'deviceToken' => $this->device_token, |
|
21 | + 'accessToken' => $this->access_token, |
|
22 | + 'user' => new UserResource($this->whenLoaded('user')), |
|
23 | + 'timeZone' => $this->time_zone, |
|
24 | + 'createdAt' => $this->created_at, |
|
25 | + 'updatedAt' => $this->updated_at, |
|
26 | + ]; |
|
27 | + } |
|
28 | 28 | } |
@@ -9,47 +9,47 @@ |
||
9 | 9 | |
10 | 10 | class PushNotificationDevicesController 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 = ['registerDevice']; |
|
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 = ['registerDevice']; |
|
18 | 18 | |
19 | - /** |
|
20 | - * The validations rules used by the base api controller |
|
21 | - * to check before add. |
|
22 | - * @var array |
|
23 | - */ |
|
24 | - protected $validationRules = [ |
|
25 | - 'device_token' => 'required|string|max:255', |
|
26 | - 'user_id' => 'required|exists:users,id' |
|
27 | - ]; |
|
19 | + /** |
|
20 | + * The validations rules used by the base api controller |
|
21 | + * to check before add. |
|
22 | + * @var array |
|
23 | + */ |
|
24 | + protected $validationRules = [ |
|
25 | + 'device_token' => 'required|string|max:255', |
|
26 | + 'user_id' => 'required|exists:users,id' |
|
27 | + ]; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Init new object. |
|
31 | - * |
|
32 | - * @param PushNotificationDeviceRepository $repo |
|
33 | - * @param CoreConfig $config |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function __construct(PushNotificationDeviceRepository $repo, CoreConfig $config) |
|
37 | - { |
|
38 | - parent::__construct($repo, $config, 'App\Modules\Notifications\Http\Resources\PushNotificationDevice'); |
|
39 | - } |
|
29 | + /** |
|
30 | + * Init new object. |
|
31 | + * |
|
32 | + * @param PushNotificationDeviceRepository $repo |
|
33 | + * @param CoreConfig $config |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function __construct(PushNotificationDeviceRepository $repo, CoreConfig $config) |
|
37 | + { |
|
38 | + parent::__construct($repo, $config, 'App\Modules\Notifications\Http\Resources\PushNotificationDevice'); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Register the given device to the logged in user. |
|
43 | - * |
|
44 | - * @param \Illuminate\Http\Request $request |
|
45 | - * @return \Illuminate\Http\Response |
|
46 | - */ |
|
47 | - public function registerDevice(Request $request) |
|
48 | - { |
|
49 | - $this->validate($request, [ |
|
50 | - 'device_token' => 'required|string|max:255' |
|
51 | - ]); |
|
41 | + /** |
|
42 | + * Register the given device to the logged in user. |
|
43 | + * |
|
44 | + * @param \Illuminate\Http\Request $request |
|
45 | + * @return \Illuminate\Http\Response |
|
46 | + */ |
|
47 | + public function registerDevice(Request $request) |
|
48 | + { |
|
49 | + $this->validate($request, [ |
|
50 | + 'device_token' => 'required|string|max:255' |
|
51 | + ]); |
|
52 | 52 | |
53 | - return new $this->modelResource($this->repo->registerDevice($request->all())); |
|
54 | - } |
|
53 | + return new $this->modelResource($this->repo->registerDevice($request->all())); |
|
54 | + } |
|
55 | 55 | } |
@@ -9,65 +9,65 @@ |
||
9 | 9 | |
10 | 10 | class NotificationsController 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 = ['markAsRead', 'markAllAsRead', 'list', 'unread']; |
|
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 = ['markAsRead', 'markAllAsRead', 'list', 'unread']; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Init new object. |
|
21 | - * |
|
22 | - * @param NotificationRepository $repo |
|
23 | - * @param CoreConfig $config |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function __construct(NotificationRepository $repo, CoreConfig $config) |
|
27 | - { |
|
28 | - parent::__construct($repo, $config, 'App\Modules\Notifications\Http\Resources\Notification'); |
|
29 | - } |
|
19 | + /** |
|
20 | + * Init new object. |
|
21 | + * |
|
22 | + * @param NotificationRepository $repo |
|
23 | + * @param CoreConfig $config |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function __construct(NotificationRepository $repo, CoreConfig $config) |
|
27 | + { |
|
28 | + parent::__construct($repo, $config, 'App\Modules\Notifications\Http\Resources\Notification'); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Retrieve all notifications of the logged in user. |
|
33 | - * |
|
34 | - * @param integer $perPage Number of rows per page default all data. |
|
35 | - * @return \Illuminate\Http\Response |
|
36 | - */ |
|
37 | - public function list($perPage = 0) |
|
38 | - { |
|
39 | - return $this->modelResource::collection($this->repo->list($perPage)); |
|
40 | - } |
|
31 | + /** |
|
32 | + * Retrieve all notifications of the logged in user. |
|
33 | + * |
|
34 | + * @param integer $perPage Number of rows per page default all data. |
|
35 | + * @return \Illuminate\Http\Response |
|
36 | + */ |
|
37 | + public function list($perPage = 0) |
|
38 | + { |
|
39 | + return $this->modelResource::collection($this->repo->list($perPage)); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Retrieve unread notifications of the logged in user. |
|
44 | - * |
|
45 | - * @param integer $perPage Number of rows per page default all data. |
|
46 | - * @return \Illuminate\Http\Response |
|
47 | - */ |
|
48 | - public function unread($perPage = 0) |
|
49 | - { |
|
50 | - return $this->modelResource::collection($this->repo->unread($perPage)); |
|
51 | - } |
|
42 | + /** |
|
43 | + * Retrieve unread notifications of the logged in user. |
|
44 | + * |
|
45 | + * @param integer $perPage Number of rows per page default all data. |
|
46 | + * @return \Illuminate\Http\Response |
|
47 | + */ |
|
48 | + public function unread($perPage = 0) |
|
49 | + { |
|
50 | + return $this->modelResource::collection($this->repo->unread($perPage)); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Mark the notification as read. |
|
55 | - * |
|
56 | - * @param integer $id Id of the notification. |
|
57 | - * @return \Illuminate\Http\Response |
|
58 | - */ |
|
59 | - public function markAsRead($id) |
|
60 | - { |
|
61 | - return new GeneralResource($this->repo->markAsRead($id)); |
|
62 | - } |
|
53 | + /** |
|
54 | + * Mark the notification as read. |
|
55 | + * |
|
56 | + * @param integer $id Id of the notification. |
|
57 | + * @return \Illuminate\Http\Response |
|
58 | + */ |
|
59 | + public function markAsRead($id) |
|
60 | + { |
|
61 | + return new GeneralResource($this->repo->markAsRead($id)); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * Mark all notifications as read. |
|
66 | - * |
|
67 | - * @return \Illuminate\Http\Response |
|
68 | - */ |
|
69 | - public function markAllAsRead() |
|
70 | - { |
|
71 | - return new GeneralResource($this->repo->markAllAsRead()); |
|
72 | - } |
|
64 | + /** |
|
65 | + * Mark all notifications as read. |
|
66 | + * |
|
67 | + * @return \Illuminate\Http\Response |
|
68 | + */ |
|
69 | + public function markAllAsRead() |
|
70 | + { |
|
71 | + return new GeneralResource($this->repo->markAllAsRead()); |
|
72 | + } |
|
73 | 73 | } |
@@ -6,37 +6,37 @@ |
||
6 | 6 | class Setting extends Model |
7 | 7 | { |
8 | 8 | |
9 | - use SoftDeletes; |
|
10 | - protected $table = 'settings'; |
|
11 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
12 | - protected $hidden = ['deleted_at']; |
|
13 | - protected $guarded = ['id', 'key']; |
|
14 | - protected $fillable = ['name', 'value']; |
|
15 | - public $searchable = ['name', 'value', 'key']; |
|
9 | + use SoftDeletes; |
|
10 | + protected $table = 'settings'; |
|
11 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
12 | + protected $hidden = ['deleted_at']; |
|
13 | + protected $guarded = ['id', 'key']; |
|
14 | + protected $fillable = ['name', 'value']; |
|
15 | + public $searchable = ['name', 'value', 'key']; |
|
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 newCollection(array $models = []) |
|
33 | - { |
|
34 | - return parent::newCollection($models)->keyBy('key'); |
|
35 | - } |
|
32 | + public function newCollection(array $models = []) |
|
33 | + { |
|
34 | + return parent::newCollection($models)->keyBy('key'); |
|
35 | + } |
|
36 | 36 | |
37 | - public static function boot() |
|
38 | - { |
|
39 | - parent::boot(); |
|
40 | - Setting::observe(\App::make('App\Modules\Core\ModelObservers\SettingsObserver')); |
|
41 | - } |
|
37 | + public static function boot() |
|
38 | + { |
|
39 | + parent::boot(); |
|
40 | + Setting::observe(\App::make('App\Modules\Core\ModelObservers\SettingsObserver')); |
|
41 | + } |
|
42 | 42 | } |
@@ -6,14 +6,14 @@ |
||
6 | 6 | |
7 | 7 | class General extends JsonResource |
8 | 8 | { |
9 | - /** |
|
10 | - * Transform the resource into an array. |
|
11 | - * |
|
12 | - * @param \Illuminate\Http\Request $request |
|
13 | - * @return array |
|
14 | - */ |
|
15 | - public function toArray($request) |
|
16 | - { |
|
17 | - return ['status' => $this->resource ?? 'success']; |
|
18 | - } |
|
9 | + /** |
|
10 | + * Transform the resource into an array. |
|
11 | + * |
|
12 | + * @param \Illuminate\Http\Request $request |
|
13 | + * @return array |
|
14 | + */ |
|
15 | + public function toArray($request) |
|
16 | + { |
|
17 | + return ['status' => $this->resource ?? 'success']; |
|
18 | + } |
|
19 | 19 | } |