Rename field for less confusion.

This commit is contained in:
James Cole 2023-10-22 07:12:47 +02:00
parent 9b22c16f14
commit 704fc24d20
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
4 changed files with 6 additions and 6 deletions

View File

@ -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');
}
/**

View File

@ -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');
}
/**

View File

@ -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');
}
/**

View File

@ -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');