Skip to content

Commit

Permalink
EloquentDataSource - avoid crash when model's primary key is not a st…
Browse files Browse the repository at this point in the history
…ring.
  • Loading branch information
itsgoingd committed Oct 21, 2024
1 parent 806cc10 commit a59d44f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Clockwork/DataSource/EloquentDataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ protected function getModelResolvingScope()
// Returns model key without crashing when using Eloquent strict mode and it's not loaded
protected function getModelKey($model)
{
// Some applications use non-string primary keys, even when this is not supported by Laravel
if (! is_string($model->getKeyName())) return;

try {
return $model->getKey();
} catch (\Illuminate\Database\Eloquent\MissingAttributeException $e) {}
Expand Down

0 comments on commit a59d44f

Please sign in to comment.