@@ -6,46 +6,46 @@ |
||
| 6 | 6 | |
| 7 | 7 | class NotificationsTableSeeder 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 | - * notifications model permissions. |
|
| 23 | - */ |
|
| 24 | - [ |
|
| 25 | - 'name' => 'all', |
|
| 26 | - 'model' => 'notifications', |
|
| 27 | - 'created_at' => \DB::raw('NOW()'), |
|
| 28 | - 'updated_at' => \DB::raw('NOW()') |
|
| 29 | - ], |
|
| 30 | - [ |
|
| 31 | - 'name' => 'unread', |
|
| 32 | - 'model' => 'notifications', |
|
| 33 | - 'created_at' => \DB::raw('NOW()'), |
|
| 34 | - 'updated_at' => \DB::raw('NOW()') |
|
| 35 | - ], |
|
| 36 | - [ |
|
| 37 | - 'name' => 'markAsRead', |
|
| 38 | - 'model' => 'notifications', |
|
| 39 | - 'created_at' => \DB::raw('NOW()'), |
|
| 40 | - 'updated_at' => \DB::raw('NOW()') |
|
| 41 | - ], |
|
| 42 | - [ |
|
| 43 | - 'name' => 'markAllAsRead', |
|
| 44 | - 'model' => 'notifications', |
|
| 45 | - 'created_at' => \DB::raw('NOW()'), |
|
| 46 | - 'updated_at' => \DB::raw('NOW()') |
|
| 47 | - ] |
|
| 48 | - ] |
|
| 49 | - ); |
|
| 50 | - } |
|
| 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 | + * notifications model permissions. |
|
| 23 | + */ |
|
| 24 | + [ |
|
| 25 | + 'name' => 'all', |
|
| 26 | + 'model' => 'notifications', |
|
| 27 | + 'created_at' => \DB::raw('NOW()'), |
|
| 28 | + 'updated_at' => \DB::raw('NOW()') |
|
| 29 | + ], |
|
| 30 | + [ |
|
| 31 | + 'name' => 'unread', |
|
| 32 | + 'model' => 'notifications', |
|
| 33 | + 'created_at' => \DB::raw('NOW()'), |
|
| 34 | + 'updated_at' => \DB::raw('NOW()') |
|
| 35 | + ], |
|
| 36 | + [ |
|
| 37 | + 'name' => 'markAsRead', |
|
| 38 | + 'model' => 'notifications', |
|
| 39 | + 'created_at' => \DB::raw('NOW()'), |
|
| 40 | + 'updated_at' => \DB::raw('NOW()') |
|
| 41 | + ], |
|
| 42 | + [ |
|
| 43 | + 'name' => 'markAllAsRead', |
|
| 44 | + 'model' => 'notifications', |
|
| 45 | + 'created_at' => \DB::raw('NOW()'), |
|
| 46 | + 'updated_at' => \DB::raw('NOW()') |
|
| 47 | + ] |
|
| 48 | + ] |
|
| 49 | + ); |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -6,16 +6,16 @@ |
||
| 6 | 6 | |
| 7 | 7 | class NotificationsDatabaseSeeder extends Seeder |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the database seeds. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function run() |
|
| 15 | - { |
|
| 16 | - $this->call(ClearDataSeeder::class); |
|
| 17 | - $this->call(NotificationsTableSeeder::class); |
|
| 18 | - $this->call(PushNotificationsDevicesTableSeeder::class); |
|
| 19 | - $this->call(AssignRelationsSeeder::class); |
|
| 20 | - } |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $this->call(ClearDataSeeder::class); |
|
| 17 | + $this->call(NotificationsTableSeeder::class); |
|
| 18 | + $this->call(PushNotificationsDevicesTableSeeder::class); |
|
| 19 | + $this->call(AssignRelationsSeeder::class); |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -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 | } |