Skip to content

Commit

Permalink
fix: primary key
Browse files Browse the repository at this point in the history
id changed to getKeyName
  • Loading branch information
lee-to committed Jul 26, 2023
1 parent 5abbd7d commit 15c34bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Notifications/MoonShineNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ public static function send(
MoonShineAuth::model()->query()
->when(
$ids,
fn ($query): Builder => $query->whereIn('id', $ids)
fn ($query): Builder => $query->whereIn(
MoonShineAuth::model()?->getKeyName() ?? 'id',
$ids
)
)
->get(),
MoonShineDatabaseNotification::make(
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/Fields/WithJsonValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function jsonValues(Model $item = null): array
$fieldValue = $field->formViewValue($data);

if ($field instanceof BelongsToMany) {
$fieldValue = $fieldValue->pluck('id');
$fieldValue = $fieldValue->pluck($data->getKeyName());
}

$values[$index][$field->field()] = $fieldValue;
Expand Down

0 comments on commit 15c34bb

Please sign in to comment.