Skip to content

Commit

Permalink
Change DatabaseNotification keyType to match uuid (#30823)
Browse files Browse the repository at this point in the history
The default primary key for database notifications is a UUID, but the default `keyType` (from the base model) is an `int`. This causes ids with string UUIDs to be force cast as integers in MorphTo and other relationships.

https://github.com/laravel/framework/blob/f5c3c60d52eccd77274e586fc4c775374e826b0f/src/Illuminate/Database/Eloquent/Relations/Relation.php#L310-L323
  • Loading branch information
Kenneth Keegan authored and taylorotwell committed Dec 12, 2019
1 parent 6cf1542 commit e3b4f7f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Illuminate/Notifications/DatabaseNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

class DatabaseNotification extends Model
{
/**
* The "type" of the primary key ID.
*
* @var string
*/
protected $keyType = 'string';

/**
* Indicates if the IDs are auto-incrementing.
*
Expand Down

0 comments on commit e3b4f7f

Please sign in to comment.