[Similar to #233 , but more generic]
If the primary key is not int it should be explicitly defined.
The explicit keytype is needed because Eloquent queries will otherwise assume the key is int.
For tables where the primary key is not integer, set:
public $keyType = 'string';
It already sets the following:
public $incrementing = false;
|
$body .= $this->class->field('incrementing', false, ['visibility' => 'public']); |
It already detects if the primary key is not int:
|
public function hasCustomPrimaryKeyCast() |
It detects the keytype, but not sure if we can / need to use that value.
I believe it can always be set to string if the primary key is not int.
[Similar to #233 , but more generic]
If the primary key is not int it should be explicitly defined.
The explicit keytype is needed because Eloquent queries will otherwise assume the key is int.
For tables where the primary key is not integer, set:
public $keyType = 'string';It already sets the following:
public $incrementing = false;laravel/src/Coders/Model/Factory.php
Line 439 in 2fc69cb
It already detects if the primary key is not
int:laravel/src/Coders/Model/Model.php
Line 842 in 2fc69cb
It detects the keytype, but not sure if we can / need to use that value.
I believe it can always be set to
stringif the primary key is notint.