diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php index 713bbbb32f..cf08a38f71 100644 --- a/app/Models/TransactionCurrency.php +++ b/app/Models/TransactionCurrency.php @@ -131,7 +131,7 @@ class TransactionCurrency extends Model */ public function users(): BelongsToMany { - return $this->belongsToMany(User::class)->withTimestamps()->withPivot('default'); + return $this->belongsToMany(User::class)->withTimestamps()->withPivot('user_default'); } /** @@ -141,7 +141,7 @@ class TransactionCurrency extends Model */ public function userGroups(): BelongsToMany { - return $this->belongsToMany(UserGroup::class)->withTimestamps()->withPivot('default'); + return $this->belongsToMany(UserGroup::class)->withTimestamps()->withPivot('group_default'); } /** diff --git a/app/Models/UserGroup.php b/app/Models/UserGroup.php index ac8b3c8320..e1958fa7c5 100644 --- a/app/Models/UserGroup.php +++ b/app/Models/UserGroup.php @@ -137,7 +137,7 @@ class UserGroup extends Model */ public function currencies(): BelongsToMany { - return $this->belongsToMany(TransactionCurrency::class); + return $this->belongsToMany(TransactionCurrency::class)->withTimestamps()->withPivot('group_default'); } /** diff --git a/app/User.php b/app/User.php index dc9af881bf..cac5cbf8ca 100644 --- a/app/User.php +++ b/app/User.php @@ -239,7 +239,7 @@ class User extends Authenticatable */ public function currencies(): BelongsToMany { - return $this->belongsToMany(TransactionCurrency::class)->withTimestamps()->withPivot('default'); + return $this->belongsToMany(TransactionCurrency::class)->withTimestamps()->withPivot('user_default'); } /** diff --git a/database/migrations/2023_10_21_113213_add_currency_pivot_tables.php b/database/migrations/2023_10_21_113213_add_currency_pivot_tables.php index c20b4b1173..214729e075 100644 --- a/database/migrations/2023_10_21_113213_add_currency_pivot_tables.php +++ b/database/migrations/2023_10_21_113213_add_currency_pivot_tables.php @@ -18,7 +18,7 @@ return new class extends Migration { $table->timestamps(); $table->integer('user_id', false, true); $table->integer('transaction_currency_id', false, true); - $table->boolean('default')->default(false); + $table->boolean('user_default')->default(false); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); $table->unique(['user_id', 'transaction_currency_id'],'unique_combo'); @@ -37,7 +37,7 @@ return new class extends Migration { $table->timestamps(); $table->bigInteger('user_group_id', false, true); $table->integer('transaction_currency_id', false, true); - $table->boolean('default')->default(false); + $table->boolean('group_default')->default(false); $table->foreign('user_group_id')->references('id')->on('user_groups')->onDelete('cascade'); $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); $table->unique(['user_group_id', 'transaction_currency_id'],'unique_combo');