This is not possible - there are only a few examples when you want to associate a unique column in a table that is also not pk. However, other structures have developed methods for changing the primary key, and no one has formally requested it for Laravel. You can write an offer on GitHub , and it may be included in a future version.
Looking at your specific example for a moment - this may have unexpected results when you come to use relationships in impatient loading situations, and this takes into account only one side of the relationship. When you add applyTo to Other, you will have the opposite problem.
It is possible to establish communication through isbn; however, this will take the form of a hasOne book ISBN, ISBN belongs to the book, ISBN hasMany Others, Other belongs to ISBN; and access to the properties will look like $book->isbn->others or $other->isbn->book .
My last suggestion was to expand the book and set the primary key of the new class as isbn and base all your relationships on this model. This is not ideal, but it would be less painful that some other solutions.
source share