webpatser/laravel-uuid

Laravel findOrFail support

sandervanhooft opened this issue · 4 comments

Hi,

While using the findOrFail(id) method, I noticed that Eloquent returns a record matching a different id than the one I pass in. It does not throw an error, so it took me some time to find this flaw.

Am I correct to assume that findOrFail() is currently not supported by this package?

Kind regards,

Sander

ctf0 commented

unfortunately the packaged docs isn't sufficient regarding using it for table PK.
check https://medium.com/@steveazz/setting-up-uuids-in-laravel-5-552412db2088#.h54xasnba

btw any chance you could have duplicated uuid in ur db ? as the default uuid is v4 which is random

Hi @ctf0 ,

See here, this repo has fixed the problem with a findOrFail trait.

@sandervanhooft that repo was actually to work with a binary type column, not relevant i'm afraid

I updated the readme with an Eloquent section. Maybe this is what you need.