Commit 05e550d
Fix Table attribute incrementing not working for Pivot models (#59336)
* Fix Table attribute incrementing not working for Pivot models
The `#[Table]` attribute includes an argument to specify whether the primary key should be incrementing. However, for Pivot models that default to non-incrementing, the Table attribute's incrementing argument was not being applied because the logic only checked it when `$this->incrementing === true`.
This fix removes the outer condition so that the Table attribute can override the default incrementing behavior for all models, including Pivots.
* Update Model.php
---------
Co-authored-by: Taylor Otwell <taylor@laravel.com>1 parent 8aa511e commit 05e550d
File tree
2 files changed
+17
-6
lines changed- src/Illuminate/Database/Eloquent
- tests/Database
2 files changed
+17
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
455 | 453 | | |
456 | 454 | | |
457 | 455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
110 | 117 | | |
111 | 118 | | |
112 | 119 | | |
| |||
504 | 511 | | |
505 | 512 | | |
506 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
0 commit comments