@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class Notifications extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('notifications', function (Blueprint $table) { |
|
17 | - $table->uuid('id')->primary(); |
|
18 | - $table->string('type'); |
|
19 | - $table->morphs('notifiable'); |
|
20 | - $table->text('data'); |
|
21 | - $table->timestamp('read_at')->nullable(); |
|
22 | - $table->timestamps(); |
|
23 | - }); |
|
24 | - } |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('notifications', function (Blueprint $table) { |
|
17 | + $table->uuid('id')->primary(); |
|
18 | + $table->string('type'); |
|
19 | + $table->morphs('notifiable'); |
|
20 | + $table->text('data'); |
|
21 | + $table->timestamp('read_at')->nullable(); |
|
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('notifications'); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Reverse the migrations. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function down() |
|
32 | + { |
|
33 | + Schema::dropIfExists('notifications'); |
|
34 | + } |
|
35 | 35 | } |
@@ -6,33 +6,33 @@ |
||
6 | 6 | |
7 | 7 | class CreateJobsTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('jobs', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->string('queue'); |
|
19 | - $table->longText('payload'); |
|
20 | - $table->tinyInteger('attempts')->unsigned(); |
|
21 | - $table->unsignedInteger('reserved_at')->nullable(); |
|
22 | - $table->unsignedInteger('available_at'); |
|
23 | - $table->unsignedInteger('created_at'); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('jobs', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->string('queue'); |
|
19 | + $table->longText('payload'); |
|
20 | + $table->tinyInteger('attempts')->unsigned(); |
|
21 | + $table->unsignedInteger('reserved_at')->nullable(); |
|
22 | + $table->unsignedInteger('available_at'); |
|
23 | + $table->unsignedInteger('created_at'); |
|
24 | 24 | |
25 | - $table->index(['queue', 'reserved_at']); |
|
26 | - }); |
|
27 | - } |
|
25 | + $table->index(['queue', 'reserved_at']); |
|
26 | + }); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Reverse the migrations. |
|
31 | - * |
|
32 | - * @return void |
|
33 | - */ |
|
34 | - public function down() |
|
35 | - { |
|
36 | - Schema::dropIfExists('jobs'); |
|
37 | - } |
|
29 | + /** |
|
30 | + * Reverse the migrations. |
|
31 | + * |
|
32 | + * @return void |
|
33 | + */ |
|
34 | + public function down() |
|
35 | + { |
|
36 | + Schema::dropIfExists('jobs'); |
|
37 | + } |
|
38 | 38 | } |
@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class CreateFailedJobsTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('failed_jobs', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->text('connection'); |
|
19 | - $table->text('queue'); |
|
20 | - $table->longText('payload'); |
|
21 | - $table->longText('exception'); |
|
22 | - $table->timestamp('failed_at')->useCurrent(); |
|
23 | - }); |
|
24 | - } |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('failed_jobs', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->text('connection'); |
|
19 | + $table->text('queue'); |
|
20 | + $table->longText('payload'); |
|
21 | + $table->longText('exception'); |
|
22 | + $table->timestamp('failed_at')->useCurrent(); |
|
23 | + }); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Reverse the migrations. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function down() |
|
32 | - { |
|
33 | - Schema::dropIfExists('failed_jobs'); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Reverse the migrations. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function down() |
|
32 | + { |
|
33 | + Schema::dropIfExists('failed_jobs'); |
|
34 | + } |
|
35 | 35 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $table->unique(array('device_token', 'user_id')); |
21 | 21 | $table->softDeletes(); |
22 | 22 | $table->timestamps(); |
23 | - }); |
|
23 | + }); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $factory->define(App\Modules\Notifications\Notification::class, function (Faker\Generator $faker) { |
4 | - return [ |
|
4 | + return [ |
|
5 | 5 | 'type' => '', |
6 | 6 | 'notifiable_type' => '', |
7 | 7 | 'notifiable_id' => '', |
@@ -9,5 +9,5 @@ discard block |
||
9 | 9 | 'read_at' => null, |
10 | 10 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
11 | 11 | 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
12 | - ]; |
|
12 | + ]; |
|
13 | 13 | }); |
14 | 14 | \ No newline at end of file |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $factory->define(App\Modules\Notifications\PushNotificationDevice::class, function (Faker\Generator $faker) { |
4 | - return [ |
|
4 | + return [ |
|
5 | 5 | 'device_token' => $faker->sha1(), |
6 | 6 | 'user_id' => $faker->randomDigitNotNull(), |
7 | 7 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
8 | 8 | 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
9 | - ]; |
|
9 | + ]; |
|
10 | 10 | }); |
11 | 11 | \ No newline at end of file |
@@ -5,23 +5,23 @@ |
||
5 | 5 | |
6 | 6 | class Notification extends DatabaseNotification{ |
7 | 7 | |
8 | - public function getCreatedAtAttribute($value) |
|
9 | - { |
|
10 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
11 | - } |
|
8 | + public function getCreatedAtAttribute($value) |
|
9 | + { |
|
10 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
11 | + } |
|
12 | 12 | |
13 | - public function getUpdatedAtAttribute($value) |
|
14 | - { |
|
15 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
16 | - } |
|
13 | + public function getUpdatedAtAttribute($value) |
|
14 | + { |
|
15 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
16 | + } |
|
17 | 17 | |
18 | - public function getDeletedAtAttribute($value) |
|
19 | - { |
|
20 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
21 | - } |
|
18 | + public function getDeletedAtAttribute($value) |
|
19 | + { |
|
20 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
21 | + } |
|
22 | 22 | |
23 | - public function getReadAtAttribute($value) |
|
24 | - { |
|
25 | - return ! $value ? false : \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
26 | - } |
|
23 | + public function getReadAtAttribute($value) |
|
24 | + { |
|
25 | + return ! $value ? false : \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
26 | + } |
|
27 | 27 | } |
@@ -7,42 +7,42 @@ |
||
7 | 7 | |
8 | 8 | class PushNotificationsDevicesController extends BaseApiController |
9 | 9 | { |
10 | - /** |
|
11 | - * The name of the model that is used by the base api controller |
|
12 | - * to preform actions like (add, edit ... etc). |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $model = 'pushNotificationDevices'; |
|
10 | + /** |
|
11 | + * The name of the model that is used by the base api controller |
|
12 | + * to preform actions like (add, edit ... etc). |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $model = 'pushNotificationDevices'; |
|
16 | 16 | |
17 | - /** |
|
18 | - * List of all route actions that the base api controller |
|
19 | - * will skip permissions check for them. |
|
20 | - * @var array |
|
21 | - */ |
|
22 | - protected $skipPermissionCheck = ['registerDevice']; |
|
17 | + /** |
|
18 | + * List of all route actions that the base api controller |
|
19 | + * will skip permissions check for them. |
|
20 | + * @var array |
|
21 | + */ |
|
22 | + protected $skipPermissionCheck = ['registerDevice']; |
|
23 | 23 | |
24 | - /** |
|
25 | - * The validations rules used by the base api controller |
|
26 | - * to check before add. |
|
27 | - * @var array |
|
28 | - */ |
|
29 | - protected $validationRules = [ |
|
30 | - 'device_token' => 'required|string|max:255', |
|
31 | - 'user_id' => 'required|exists:users,id' |
|
32 | - ]; |
|
24 | + /** |
|
25 | + * The validations rules used by the base api controller |
|
26 | + * to check before add. |
|
27 | + * @var array |
|
28 | + */ |
|
29 | + protected $validationRules = [ |
|
30 | + 'device_token' => 'required|string|max:255', |
|
31 | + 'user_id' => 'required|exists:users,id' |
|
32 | + ]; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Register the given device to the logged in user. |
|
36 | - * |
|
37 | - * @param \Illuminate\Http\Request $request |
|
38 | - * @return \Illuminate\Http\Response |
|
39 | - */ |
|
40 | - public function registerDevice(Request $request) |
|
41 | - { |
|
42 | - $this->validate($request, [ |
|
43 | - 'device_token' => 'required|string|max:255' |
|
44 | - ]); |
|
34 | + /** |
|
35 | + * Register the given device to the logged in user. |
|
36 | + * |
|
37 | + * @param \Illuminate\Http\Request $request |
|
38 | + * @return \Illuminate\Http\Response |
|
39 | + */ |
|
40 | + public function registerDevice(Request $request) |
|
41 | + { |
|
42 | + $this->validate($request, [ |
|
43 | + 'device_token' => 'required|string|max:255' |
|
44 | + ]); |
|
45 | 45 | |
46 | - return \Response::json($this->repo->registerDevice($request->all()), 200); |
|
47 | - } |
|
46 | + return \Response::json($this->repo->registerDevice($request->all()), 200); |
|
47 | + } |
|
48 | 48 | } |
@@ -7,60 +7,60 @@ |
||
7 | 7 | |
8 | 8 | class NotificationsController extends BaseApiController |
9 | 9 | { |
10 | - /** |
|
11 | - * The name of the model that is used by the base api controller |
|
12 | - * to preform actions like (add, edit ... etc). |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $model = 'notifications'; |
|
10 | + /** |
|
11 | + * The name of the model that is used by the base api controller |
|
12 | + * to preform actions like (add, edit ... etc). |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $model = 'notifications'; |
|
16 | 16 | |
17 | - /** |
|
18 | - * List of all route actions that the base api controller |
|
19 | - * will skip permissions check for them. |
|
20 | - * @var array |
|
21 | - */ |
|
22 | - protected $skipPermissionCheck = ['markAsRead', 'markAllAsRead', 'list', 'unread']; |
|
17 | + /** |
|
18 | + * List of all route actions that the base api controller |
|
19 | + * will skip permissions check for them. |
|
20 | + * @var array |
|
21 | + */ |
|
22 | + protected $skipPermissionCheck = ['markAsRead', 'markAllAsRead', 'list', 'unread']; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Retrieve all notifications of the logged in user. |
|
26 | - * |
|
27 | - * @param integer $perPage Number of rows per page default all data. |
|
28 | - * @return \Illuminate\Http\Response |
|
29 | - */ |
|
30 | - public function list($perPage = 0) |
|
31 | - { |
|
32 | - return \Response::json($this->repo->list($perPage), 200); |
|
33 | - } |
|
24 | + /** |
|
25 | + * Retrieve all notifications of the logged in user. |
|
26 | + * |
|
27 | + * @param integer $perPage Number of rows per page default all data. |
|
28 | + * @return \Illuminate\Http\Response |
|
29 | + */ |
|
30 | + public function list($perPage = 0) |
|
31 | + { |
|
32 | + return \Response::json($this->repo->list($perPage), 200); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Retrieve unread notifications of the logged in user. |
|
37 | - * |
|
38 | - * @param integer $perPage Number of rows per page default all data. |
|
39 | - * @return \Illuminate\Http\Response |
|
40 | - */ |
|
41 | - public function unread($perPage = 0) |
|
42 | - { |
|
43 | - return \Response::json($this->repo->unread($perPage), 200); |
|
44 | - } |
|
35 | + /** |
|
36 | + * Retrieve unread notifications of the logged in user. |
|
37 | + * |
|
38 | + * @param integer $perPage Number of rows per page default all data. |
|
39 | + * @return \Illuminate\Http\Response |
|
40 | + */ |
|
41 | + public function unread($perPage = 0) |
|
42 | + { |
|
43 | + return \Response::json($this->repo->unread($perPage), 200); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Mark the notification as read. |
|
48 | - * |
|
49 | - * @param integer $id Id of the notification. |
|
50 | - * @return \Illuminate\Http\Response |
|
51 | - */ |
|
52 | - public function markAsRead($id) |
|
53 | - { |
|
54 | - return \Response::json($this->repo->markAsRead($id), 200); |
|
55 | - } |
|
46 | + /** |
|
47 | + * Mark the notification as read. |
|
48 | + * |
|
49 | + * @param integer $id Id of the notification. |
|
50 | + * @return \Illuminate\Http\Response |
|
51 | + */ |
|
52 | + public function markAsRead($id) |
|
53 | + { |
|
54 | + return \Response::json($this->repo->markAsRead($id), 200); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Mark all notifications as read. |
|
59 | - * |
|
60 | - * @return \Illuminate\Http\Response |
|
61 | - */ |
|
62 | - public function markAllAsRead() |
|
63 | - { |
|
64 | - return \Response::json($this->repo->markAllAsRead(), 200); |
|
65 | - } |
|
57 | + /** |
|
58 | + * Mark all notifications as read. |
|
59 | + * |
|
60 | + * @return \Illuminate\Http\Response |
|
61 | + */ |
|
62 | + public function markAllAsRead() |
|
63 | + { |
|
64 | + return \Response::json($this->repo->markAllAsRead(), 200); |
|
65 | + } |
|
66 | 66 | } |