diff --git a/app/Models/ObjectGroup.php b/app/Models/ObjectGroup.php new file mode 100644 index 0000000000..74a4dc3647 --- /dev/null +++ b/app/Models/ObjectGroup.php @@ -0,0 +1,21 @@ +morphedByMany(PiggyBank::class, 'object_groupable'); + } +} diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index 732cb98c98..4b9f3af2f8 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -126,6 +126,14 @@ class PiggyBank extends Model throw new NotFoundHttpException; } + /** + * Get all of the tags for the post. + */ + public function objectGroups() + { + return $this->morphToMany(ObjectGroup::class, 'object_groupable'); + } + /** * @codeCoverageIgnore * @return MorphMany diff --git a/config/firefly.php b/config/firefly.php index 0b4edfb6f9..68597b46e3 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -145,7 +145,7 @@ return [ 'encryption' => null === env('USE_ENCRYPTION') || true === env('USE_ENCRYPTION'), 'version' => '5.2.6', 'api_version' => '1.1.0', - 'db_version' => 13, + 'db_version' => 14, 'maxUploadSize' => 15242880, 'send_error_message' => env('SEND_ERROR_MESSAGE', true), 'site_owner' => env('SITE_OWNER', ''), diff --git a/database/migrations/2020_06_05_061116_changes_for_v530.php b/database/migrations/2020_06_05_061116_changes_for_v530.php new file mode 100644 index 0000000000..32c939a80c --- /dev/null +++ b/database/migrations/2020_06_05_061116_changes_for_v530.php @@ -0,0 +1,63 @@ +dropColumn('provider'); + } + ); + Schema::dropIfExists('object_groupables'); + Schema::dropIfExists('object_groups'); + } + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::table( + 'users', static function (Blueprint $table) { + $table->string('provider', 50)->nullable(); + } + ); + + if (!Schema::hasTable('object_groups')) { + Schema::create( + 'object_groups', static function (Blueprint $table) { + $table->increments('id'); + $table->timestamps(); + $table->softDeletes(); + $table->string('title', 255); + $table->mediumInteger('order', false, true)->default(0); + } + ); + } + + if (!Schema::hasTable('object_groupables')) { + Schema::create( + 'object_groupables', static function (Blueprint $table) { + $table->integer('object_group_id'); + $table->integer('object_groupable_id', false, true); + $table->string('object_groupable_type', 255); + } + ); + } + } +}